What does "Version" mean when viewing reference properties in Visual Studio? - visual-studio

I am currently battling "DLL hell" in Visual Studio 2017. For unknown reasons, I suddenly got a problem with System.ValueTuple, where the error I get is the classic problem that have been asked many times before:
Could not load file or assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
I cannot really figure it out, as I don't think I should have any reference to 4.0.2.0. VS tells me the following:
What I don't get is how the "Version" of the System.ValueTuple says 4.0.2.0, when I have installed version 4.4.0 according to the path of the DLL and according to NuGet Manager.
So, why is it like this?

Related

Visual Studio Could not load assembly

I have a C# project using MySql.Data and EntityFramework, and have used the Data Entity Model Wizard to create code based on an existing database. I created the project on a machine running MySql Server 8.0.25 (where I cannot control the installed version), so all my references for MySql packages are also version 8.0.25.
When I moved the project onto my own machine, running MySql Server version 8.0.31, the project successfully builds but has an error message, which Visual Studio says comes from a .edmx file:
Error 4: Could not load file or assembly 'MySql.Data, Version=8.0.31.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ... ScheduleModel.edmx 7
The file in question only contains the text "MySql.Data" in one place, and that's an un-versioned reference to "MySql.Data.MySqlClient", on line 7.
Since the project builds and appears to run correctly, I don't know if this error affects anything. Regardless, I would like to understand it and why it happens and ideally make it go away.
Here's what I've learned form searching for an answer and trying to investigate/fix the error:
There are no references to version 8.0.31 anywhere in my project, as using Visual Studio to search the entire project for "8.0.31" found no results.
Answers to others' questions tell me the version number in the error message specifies the version of a file that Visual Studio DID find. (Whereas I would have thought the given version number is the one that it is LOOKING for.)
Several places said that the found version is probably in the GAC. Originally, the error message said MySql.Data.EntityFramework (not just MySql.Data), and I did find MySql.Data.EntityFramework in the GAC. (No idea how it got there.) After removing it, the error message changed to just MySql.Data. However, MySql.Data is not in the GAC, and no MySql.Data.* are still there either.
There's a tool called fuslogvw.exe that supposedly can help with this issue, but I could not get it to work. When I run it, there is nothing in the log. When I click on options, all options are grayed out. The one person's recommended registry edit did not work either. (I tried closing and re-opening Visual Studio after said edit, then re-building.)
Process Monitor tells me that, during the build process, no processes accessed any files that include "MySql.Data" in the name except those under packages/MySql.Data.8.0.25 and the project's output directory; all files are version 8.0.25. This appears to conflict with #1, because how can Visual Studio have found version 8.0.31 if it never accessed any such file?
I tried using bindingRedirect in App.config to redirect from 8.0.31 to 8.0.25, which had no apparent effect.
Cleaning the solution and re-building ends up putting MySql.Data version 8.0.25 back into the output directory, so Visual Studio clearly is finding the correct version.
Deleting the packages folder results in everything being replaced (with the right version, again) but the error message persists. (The rebuild was strangely fast; I'd have thought everything would have to be re-downloaded, but it was too fast to have done that.)
How would I diagnose this issue? What might be causing Visual Studio to look for or to find a version that I cannot find any reference to, or any .dll file for?
I'm using Visual Studio Community 2019, Version 16.11.2.

The “GetDeploymentPathFromVsixManifest” task failed unexpectedly

What to do to solve "The “GetDeploymentPathFromVsixManifest” task failed unexpectedly" when trying to debug a VS extension project??
Same question was already asked multiple times with different source reasons, all for VS2017 usually for upgrading VS extensions from VS2015, and it should have been solved with VS 2019. Yet, it just popped up.
The "GetDeploymentPathFromVsixManifest" task failed unexpectedly.
System.TypeLoadException: Method 'get_JoinableTaskFactory' in type 'Microsoft.VisualStudio.Sdk.BuildTasks.ExtensionEngineHost' from assembly 'Microsoft.VisualStudio.Sdk.BuildTasks.16.0, Version=16.9.2017.12405, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' does not have an implementation.
at Microsoft.VisualStudio.Sdk.BuildTasks.ExtensionManagerUtilities.GetExtensionEngine(ISettingsManager manager, Boolean deletePendingUninstalls)
at Microsoft.VisualStudio.Sdk.BuildTasks.GetDeploymentPathFromVsixManifest.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
I have tried all the solution for the same error found on SO, so far to no avail. I am using VS 2019 Community 16.9.2, updated all packages, downgraded some to try, nothing really changes this error.
This is my first attempt on VSIX and I just downloaded an existing project from github and compiled it.
The github project is working (probably) since the extension is available on the marketplace.
Any other suggestions? Searches on this error in combination with the JoinableTaskFactory dont return exactly many results.
For me the solution was to do at least one of the following steps:
Delete the obj-folder in the project
Execute Reset the Visual Studio 2019 Experimental Instance. You can find this tool when you search it in the windows search bar.
Clean and Rebuild the project
Sometimes it helped if I did only one step and sometimes it only worked after doing all the steps.
I couldn't find out if there is a specific pattern behind, but doing all of the above steps always fixed the error for me.
Another issue where I got the same error was if there was the wrong external program selected under Project Properties -> Debug -> Start external Program. For VS2019 I need to select C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe
If I switched between Visual Studio Versions, then sometimes a different Visual Studio version was selected.
Uncheck: "Deploy VSIX content to experimental instance for debugging"
in solution properties->VSIX
Also Update installed NuGet packages.

Can't load EntityFramework.dll 5.0.0.0 inside Visual Studio 2013 extension

I'm writing a Visual Studio extension which depends on EntityFramework 5.0.0.0. I included EntityFramework in my project. When I install my extension, my extension's DLL appears in VS extensions folder, and EntityFramework.dll appears with it as well.
However, when I run my Extension in Visual Studio 2013 (update 5), it can't load EntityFramework: System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
Looking in Process Monitor, I saw that when I run my extension, VS2013 tries to load EntityFramework from a different path, which has it in a different version - 4.2. I'd expect VS2013 to continue to search for EntityFramework, and find it in my extension's folder, like it does for other dlls included in my extension, but it doesn't.
In VS2015, VS does manage to load EntityFramework 5.0.0.0, but it does so also from yet another different path.
Why doesn't VS2013 continue to search for EntityFramework in my extension's folder?
You need to specify a ProvideCodeBase attribute to specify that your extra assemblies should be loaded. "Sometimes" you get lucky and it finds something else, but that's never guaranteed to work. You can see a few examples of that being used here.

Is it possible to reference different NuGet package versions in a Visual Studio solution?

We are a team composed of 7 members and we want to create a Cloud Application (Windows Azure) with Visual Studio. Our application is hosted on GitHub so we have choose to use NuGet packages to keep our repository light as possible.
However two different projects in our Visual Studio solution need reference either Newtonsoft.Json version 4.0.2 or Newtonsoft.Json version 4.5.11.
We have tried to reference the right version for each project but we get this errors on build:
The type 'Newtonsoft.Json.Linq.JObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Newtonsoft.Json, Version=4.0.2.0, Culture=neutral, PublicKeyToken=null'.
Cannot implicitly convert type 'Newtonsoft.Json.Linq.JObject' to 'Newtonsoft.Json.Linq.JObject'
The second error suggests that there are conflicts between the two versions even if no project in our solution references the two version at the same time.
Do you have any idea to solve this problem?
Thanks.
PS: Here are the most relevant information we have found about this issue.
http://docs.nuget.org/docs/reference/known-issues
https://stackoverflow.com/search?q=NuGet+multi+packages+version
After a while... Know that we have rewrite the piece of code which use the old reference to Newtonsoft.Json version 4.0.2.
Thanks.

Integrating IronScheme into Visual Studio 2010

Is there a way (or can anyone find a way) to import IronScheme into VS2010? I've already taken a look at this question, and I've done everything I could - I even edited the binary files involved to change the version numbers. My question: Does anyone have a solution for getting IronScheme installed into VisualStudio 2010? at present, following the directions to install it into VS2008 does not work for VS2010. Thanks in advance :)
Update 1: I suppose I should post the error I get when I try to follow the directions for installing it via commandline:
C:\Program Files\IronScheme>RegPkg.exe /codebase "C:\Program Files\IronScheme\IronScheme.VisualStudio.dll"
After I run that, I get a Windows 7 popup error:
RegPkg.exe Has Stopped Working - Windows is checking for a solution to
the problem...
When I click out of that, it gives me this error on the console:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.VisualStudio.Tools.RegPkg.Main(String[] arguments)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
I wrote the VS2008 plugin.
When VS2010, the whole API changed again, and if you have ever been in the VS SDK API, you will know it is a maze. I just did not feel like the effort again.
I have a bunch of great ideas but for the life of me I cannot even figure the simple stuff out.
If someone want to actually port my code from VS2008, I would appreciate it. It should not be too hard if you are a bit more familiar with the API than I am.
The source code for the VS2008 plugin is not currently available for the public. Please let me know if anyone is serious about so I can create a github (or similar) repo for it.
Update:
Created a github repo. The code is not the same as the existing DLL I distribute; it contains various half working ideas I was trying.
Update 2:
Here you go :) Very basic, but works on VS2010 and VS11 (should work on Express versions too). Source is in the vs11 branch of above mentioned github repo. It is just a subset of what the VS2008 plugin does as some features seem to be broken or have broken due to bit rot.
Update 3:
Seems the VS2010 plugin fails if only VS2010 is installed. Will have to investigate. Works fine if both VS2010 and VS11 is installed. FIXED :)
I have started rewriting a new plugin.
You can see the github repo for more details:
https://github.com/leppie/IronScheme.VisualStudio2
There is also a download available to try out :)

Resources