Visual Studio Extension (VSPackage) runs in all Experimental Instances, but does not run after being installed as a .vsix, except in VS2010 - c#

I am writing a Visual Studio extension which targets VS2010, VS2012, and VS2013. It runs and is initialized successfully in each Experimental Instance with no issues. When I install the VSIX generated by the build, it installs in all versions without a problem, but only in VS2010 does it actually execute. In the others it's never instantiated or initialized.
There are no exceptions being thrown. Running the non-Experimental instance with the /log flag does not produce any other diagnostic information (other than confirming it is installed, and has a newer version than its counterpart already in the gallery.)
My reading and experiences suggest that this is due to some sort of missing assembly or reference, but I can't confirm that. I am also at a loss as how one would figure out what's missing, especially without an exception or log message.
I've been at this for several days now trying things like signing my assemblies, various vsixmanifest changes, changing the required framework versions, and many other things found here on SO that have not been fruitful.
Additionally, I have tried installing the old, already published version from the VS Gallery, and it also does not run. However, I have received feedback (bugs and thanks) from several individuals, so I know it works for some people. I have not received any feedback stating that "nothing happens," but do not rule out the fact that those are unreported.
I don't intend to plug, but the currently published version is here: http://visualstudiogallery.msdn.microsoft.com/5cc44f63-4ea8-4c17-8aa4-95037a2d32ef
The entire source for where I currently stand can be found on github in branch "ForStackOverflow". The difference between that and master is a TraceAppender which I used to confirm that the VSPackage was not being instantiated.
https://github.com/alexcpendleton/Pendletron.Vsix.LocateInTFS/tree/ForStackOverflow
Any suggestions, experiences, or anything would be helpful. Thank you.

Thanks to Erti-Chris Eelmaa's suggestion to enable FusionLog I was able to figure out what was going on.
Visual Studio was not looking for my extension in the installed extension's directory, rather from the GAC and elsewhere. Curiously, it was finding an included assembly just fine.
I examined the .vsixmanifest of other extensions and discovered that mine was missing a .pkgdef Content node for my project. It would seem VS2010 accounts for this, or for some other reason happened to look in the extension's installation directory for the package assembly, where 2012 and 2013 did not. Adding this content node to my .vsixmanifest allowed Visual Studio to load and run the extension.
<Content>
<VsPackage>Pendletron.Vsix.LocateInTFS.pkgdef</VsPackage>
</Content>

Related

CefSharp - Could not load file or assembly 'CefSharp.Core.dll' or one of its dependencies

I've been working on a CefSharp WinForms app for a few weeks and I've had no issues with it. This morning, while adding a few things to the application, I tried to run it to test something and got the below error:
System.IO.FileNotFoundException was unhandled Message: An unhandled
exception of type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll Additional information: Could not load file or assembly
'CefSharp.Core.dll' or one of its dependencies. The specified module
could not be found.
After searching for a while I found this:
https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#Runtime_dependencies
I checked bin/Debug/x86 for the project and all of the dependencies appear to be present. More importantly, it had been working fine five minutes earlier, and I didn't touch anything beyond a single class for an Entity Framework migration.
I've tried cleaning and rebuilding the solution, restarting Visual Studio, restarting my PC, and clearing out /bin/Debug, and none of these have helped.
Why would this error appear now after several days without it, and how can I resolve the issue?
Edit: I've done some further experimenting and I'm able to get the application to run in Release mode but not Debug mode. If I change the output path of Release mode to Debug, it fails with the same error (likewise, it succeeds in Debug with the Release output path).
First, make sure you installed the Microsoft Visual C++ Redistributable:
Version v93 and above: use Microsoft Visual C++ 2019 Redistributable or greater
Version v65 - v92: use Microsoft Visual C++ 2015 Redistributable or greater
Older Versions: use Microsoft Visual C++ 2013 Redistributable (exact version)
You could download the Visual C++ Redistributable from Microsoft. See C++ binary compatibility between Visual Studio versions for more detail on the version compatability.
Make sure to match the correct architecture, if your application is x64, you need to install the x64 build of Visual C++ Redistributable. Likewise if your application is x86 then you need to install the x86 build of Visual C++ Redistributable.
The Microsoft Visual C++ Redistributable depends on the Universal CRT. The Universal CRT is included as part of Windows 10/11. On older versions of Windows the Visual C++ Redistributable will install the Universal CRT.
For those wishing to include the Visual C++ Runtime with their application it's technically possible to include the runtime with your application. See also Local Deployment section of the Deployment in Visual C++ article from Microsoft.
I had the same problem until I installed the following redistributable:
SuperBerry's solution of installing VC++ redistribution package solved the problem for me. I'll just provide a little troubleshooting insights from my naïve perspective.
The error message is pretty clear, either the assemble CefSharp.Core.dll is missing or one of it's dependencies. So the question boils down to how do you figure out what is missing?
So first, do you have CefSharp.Core.dll? In the Solution Explorer look at the references for the project that is having this problem. You should find a reference to CefSharp.Core. If you can't find one, you're missing that assembly. If you have one, then the problem is that you're missing one of its required dependencies. When you click on the CefSharp.Core reference, in the detail, you'll get the full path to where it's located. In my case, it was in located at 'C:\Users\tom\source\repos\MyProject\src\packages\CefSharp.Common.41.0.0\CefSharp\x86\CefSharp.Core.dll'.
You then need to get a list of the CefSharp.Core dependencies to figure out which dependency your missing. Dumpbin.exe is a command line tool that you can use to get a list of dependencies. In order to use dumpbin, you need to make sure that it can be found on the path in your system environment variables. I found on the path of the VC Tools bin directory. In my case, I found one at: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64'. Open a Command Prompt terminal and navigate to the folder containing CefSharp.Core.dll and key in the following:
>dumpbin /dependents CefSharp.Core.dll
the result I got was:
Dump of file CefSharp.Core.dll
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
MSVCP110.dll
MSVCR110.dll
libcef.dll
USER32.dll
mscoree.dll
Not having worked with Microsoft Visual Studio for a number of years, I had to try and figure out where those dependencies are suppose to be located so that they can be resolved. I simply did an internet search such as "where is Kernel32.dll located" doing that for each dll until I found the missing dll. In my case, I could not find MSVCR110.dll, so I strongly suspected that was my problem. I then did an internet search for "MSVCR110.dll is missing" and found out that it was part of the vc++ redistribution. (SuperBerry, you were right on your first point). I also found that it could be downloaded from: 'https://www.microsoft.com/en-us/download/details.aspx?id=30679'. I downloaded both the x86 and x64 versions (although I only needed the x86 version for this project). They are executables that when run installs them. After installing them I found a copy of it in 'C:\Windows\SysWOW64' and in 'C:/Windows\System32'. And low and behold this problem was resolved.
What I learned from this process, was that it was difficult to know whether you have the right VC++ redistribution package installed or not. I thought I would have been installed when visual studio was installed with the VC++ features enabled. I'm using visual studio community version 2019. The project I am working with was a project I cloned from a GitHub source. I'm still confused about VC++ redistribution versioning. For example, could I have installed some later version and would it have worked (i.e. backward compatibility)?
I had the same issue. what worked for me is to add
<CefSharpBuildAction>Content</CefSharpBuildAction>
to the first PropertyGroup inside the csproj of the project you are dealing with.
I had the same issue even in release mode. Going through GitHub CefSharp FAQs, NOTE 2 solved my issue.
If compiling from source (not recommended, use the Nuget packages) and you notice that you can no longer build in debug mode, but release builds work just fine you may need to repair your version of Visual Studio. This happens in rare cases where you will get the same exact message as a missing unmanaged .dll file as shown above.
Had to repair Visual Studio and all started working as before.
For my future me, had this same issue and every time i get this error when i start my .net core 3.1 wpf application in visual studio -> Could not load file or assembly 'CefSharp.Core.Runtime.
That cost me hours!
My Solution: Don't initialize Cef in your WinForm or WPF Window class.
You need to initialize this in your startup main/app. In my example i need to add this:
public App()
{
CefSettings _browserSettings = new CefSettings();
...
Cef.Initialize(_browserSettings);
}

Visual Studio 2015 Community - All References Broken

I just installed VS2015 community on my home machines. On my laptop, it works great. However I've run into an odd issue on my desktop. No matter what the reference is, it displays as unable to find (yellow warning symbol). It doesn't matter what or where it is. I have tried adding framework references (As basic as System) and references to external API DLLs in the local directory like Protobuf. NuGet will download packages referenced by projects I am working on and they will also be marked invalid. The properties for these references does not include a path, even when I specify one.
I'm a develop at work so I understand how to handle these issues generally. I've tried deleting the references and re-adding them, creating new solutions from scratch, pretty much everything I can think of and I'm out of ideas.
This is a Win7 machine with .NET 4.6.1 installed. I have tried changing my projects to target framework of 2,4,4.5,4.6, and 4.6.1 (no difference). This is a C# project if it matters.
Can anyone recommend next steps? Thank you.
I found the issue. Last month I tried to upgrade to Win10 and it didn't work out for me so I rolled it back. It deleted all the ACL information on all my directories. Specifically, the access to Microsoft.CSharp.Targets was lost. I restored that and everything worked again. Of course, now I have to try and fix every file and directory on my computer so I have access again. Thanks, Win10!

Latest built installer for a project doesn't show up in Add/Remove Programs

I noticed within the past couple of weeks my latest builds of a specific project are not showing up in Add/Remove programs.
I am using Visual Studio 2010, Windows7 64-bit (though I've also tried this over two Windows 32-bit machines). All latest service packs and updates are installed. The solution is made up of several projects with various references. The Setup and Deployment project is not the Install Shield version, but the one built in Microsoft project.
Previous versions of the software install fine, and still do... But if I pull down a tagged earlier version from CVS, and rebuild the installer for those versions, they do not work either.
I've opened the MSI in Orca, and I can see that the ARPNOREMOVE, ARPSYSTEMCOMPONENT are both set to 1. When the project gets installed, a registry entry SystemComponent Dword value is created. If I remove that registry entry, the application shows up. Based on everything I've read and researched I have found people that WANTED this functionality, but were told that Visual Studio can't do this on its own. Their solutions were to use Orca to add the ARPNOREMOVE or ARPSYSTEMCOMPONENT. At this point, all of the people who I found had my problem either had a basic default installer and they didn't know what name they were looking for in Add/Remove Programs or some other basic error that doesn't apply in my situation.
I've tried all of the following:
-Previous versions of tagged versions on CVS
-Multiple development machines
-Multiple computers to verify none show up in Add/Remove programs
-Resetting all Visual Studio settings
-Building from a clean development environment
-Removing Installer project from the solution and creating a new installer project
The weird part is that if I create a new solution and just create a setup and deployment project within, that installs fine. Can anyone having any idea about this help me out ?
So this is what I found out. We are using National Instruments Measurement Studio for .Net and the legacy controls. When using the legacy controls a certain merge module gets recognized as a dependency. For whatever reason, now this merge module change the behavior of the installer that is compiled. I've contacted National Instruments and am now working with them.
First, yes, you figured out the correct property name. Yes, ARPSYSTEMCOMPONENT is it which leads to an "unvisible" install under Add/Remove programs (ARP for insiders, although the name has changed post XP).
And it is possible to set/change the resulting "SystemComponent" entry in registry later which is not the case for all properties.
ARPNOREMOVE just controls if the uninstall in ARP is really possible to perform.
I have looked into Visual Installer before really, because it is so limited for MSI experts, but after taking a quick look there is a .vdproj (project file) created with VS 2010, and not very surprisingly, all the MSI information is coded there. The visual setup editors you can see in the solution explorer are only a subset.
Just look for "ARP" and you will find some properties set. The meanings of the values are maybe not so easy to guess, but from a rational point of view:
Either there is some setting inside there or a custom action (listed there too) which sets that property!
In my minimal test with the wizard only the ARPCONTACT property was set in the resulting msi file.
At least you could take the .vdproj file cor diffs with other checkedin versions..

LibGit2Sharp fails to find git2.dll

I have built a tiny wpf app that manages a website I am working on. The key feature of this app is that it allows me to checkout different branches of a theme repository. This works perfectly in visual studio, but when I publish, install and run the app on my windows 8 machine it comes back with:
{"Unable to load DLL 'git2': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}
I have searched through the internet and stackoverflow. There are similar questions, such as Unable to load DLL 'git2.dll' The specified module could not be found but the answers provided (as well as the answers shown in the github issue described in the answer) bring up another error:
Unable to find an entry point git_reference_oid in git2.dll
I have tried installing the latest through nuget, including a compiled dll and adding the git2.dll, including the libgit2sharp project in my solution. Once again, it works perfectly when I run it all through visual studio, but fails when I publish, install and run it.
I was unsure what information needed to be included so please feel free to comment and let me know so I can update the question.
Thank you!
The computer you're running the installed executable on may lack MSVCR100.DLL or MSVCR110.DLL (depending if git2.dll has been compiled using Visual Studio 2010 or 2012).
A fix has been recently merged in libgit2 which removes the need for this dependency.
Indeed, running dumpbin /IMPORTS git2.dll against those binaries doesn't show any dependency against MSVCR1x0.dll any longer.
The latest tip of the vNext branch of the LibGit2Sharp project embeds those updated git2.dlls. It's recommended to compile the project (using the build.libgit2sharp.cmd tool and use this version (manged assembly + native binaries) instead).

Visual Studio keeps crashing

Visual studio team system 2008 keeps crashing on me. Sometimes it just freezes, or certain parts of the UI get messed up or a weird popup box saying something about unable to load parameters or saying something else about memory or any other number of things.
it usually happens when I do a "complex" task like go into debug mode or do a search across of whole solution or run a unit tests or something like that.
I rebooted my machine countless time, reinstalled it VS, changed my virtual memory settings, flush my page file on every reboot and anything else i could think of.
It seems like VS runs out memory or something.
I have a powerfully machine with lots of RAM so that's not the issue
any suggestions?
You can always try some standard Visual Studio troubleshooting steps:
Clean the solution
Delete / rename all files in your solution created by VS, i.e. all .ncb, .suo, .user files
Launch Visual Studio with all add-ins disabled: devenv.exe /SafeMode
Reset All Settings: Tools -> Import / Export Settings -> Reset All Settings
Delete HKCU:\Software\Micosoft\VisualStudio\9.0 and then restart Visual Studio
Repair the Visual Studio installation through Add/Remove Programs
You might also check whether there is a hotfix available addressing your issue (e.g. KB960075 sounds like a good candidate for you), or whether you find your problem already reported on the Connect website.
The first step is to uninstall all 3rd party add-ins on Visual Studio. In particular if you have multiple add-ins as they can interfere with each other in unexpected ways and cause crashes. After uninstalling repeat your scenarios and see if this fixes the issue.
If not then it's best to consult the application log and find out why Visual Studio is crashing. The log will contain at least the error code of the crash which can searched on google or reposted here for us to take a look at.
Assuming this occurs with VS up to date with all service packs installed, you might try some of these suggestions. If you haven't tried with service packs, do that first.
What version of Windows are you using? If it is Windows 7, try launching Visual Studio with a compatibility mode and see if that resolves the issue. To do this, make a copy of the normal launch shortcut and go into the Properties dialog and set it to run as Windows Vista.
If this doesn't fix it, then you might also consider:
Checking your PATH environment for any weird settings which might be confusing it, e.g. paths pointing to other SDKs
Any 3rd party VS extensions such as source control, refactoring plugins, wizards etc.
Old versions of .NET or SQL server
Also test if the issue occurs for every kind of project or just certain kinds, e.g. does it happen for all projects? Does it happen in C++, C#, VB.NET projects etc.
You can also attach a debugger to Visual Studio, to see what it's doing. Sometimes a particular .sln will trigger bad behavior or more likely, some third-party add-on.
If you believe that you've gotten VS into a wired state, you can try the following command line switches
devenv.exe /ResetSettings (This will reset the visual studio settings to the defaults)
If that doesn't help, as a last resort, you can try
devenv.exe /ResetUserData

Categories