Visual Studio 2012 - EntityFramework and clearing it from GAC - visual-studio

Visual Studio 2012 question:
Recently installed 2012 (2010 was on here already) ... downloaded project from TFS ... went to run the project and it needed EntityFramework ... Installed EntityFramework from NuGet ...
Here's the problem: now it is throwing an error:
Could not load file or assembly 'EntityFramework, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=...' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
With this error, we searched and found that a way to get this resolved would be to clear the instance from the GAC. I went to clear the GAC from the Visual Studio Command Prompt (which, BTW, it only came up with the 2010 command prompt) using the command:
gacutil /u "EntityFramework ..."
Which returned:
No assemblies found matching: EntityFramework
Number of assemblies uninstalled = 0
Number of failures = 0
So I was wondering if anyone may have encountered this issue and found a solution -or- if someone may have a solution to the overall problem. Thanks!

It looks like something has hard-coded a reference to EntityFramework version 4.1.
EntityFramework (according to nuget) is currently on version 5 (although I believe that the assembly version number is 4.4.0.0).
To get round this you can either install a specific version of the package (see here) or use assembly binding redirection to force it to use a later version (an example of which is shown here).

I followed this:
http://msdn.microsoft.com/en-us/library/aa559881.aspx
But the dll I was trying to uninstall was "stuck".
Which led me to this:
http://support.microsoft.com/kb/873195
I removed the registry entry.
The gacutil /u now worked.
And the error went away.
After I did the registry tweak, my full uninstall looked like this:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\gacutil.exe" /u "EntityFramework,Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

Related

May I get help resolving Package reference for .NET 4.7.2 Project?

2/3 of projects in a solution I have is running on .NET 4.7.2, the other project is a reactJS project running on .NET Core. The other two run well except one of the .NET 4.7.2 projects which seem to be trying to call packages that are not compatible with the project. The file it keeps hanging up on is the System.Threading.Tasks.Extension. The current version it is stuck on running is 4.5.2, of which I cannot downgrade and seems to not be compatible with .NET 4.7.2. I noticed that from the build logs. Here one line from the output file which seems to stand out to me:
Unified Dependency "System.Collections, Version=4.0.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Using this version instead of original version "4.0.0.0" in "C:\project\packages\System.Threading.Tasks.Extensions.4.0.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll" because there is a more recent version of this framework file.
Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\Facades\System.Collections.dll".
(ResolveAssemblyReferences target) -> C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3277: Found conflicts between different versions of "System.Threading.Tasks.Extensions" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
When the browser comes up this error is shown:
Could not load file or assembly 'System.Threading.Tasks.Extensions' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have been looking around at solutions which include meddling with the .csproj, web.config or package.config and not successful.
My goal is to have the project run successfully and resolve this conflict. Any help in resolving this issue would be greatly appreciated.
This was resolved by cleaning out all the packages and readding one by one.

VS2015 preview + TypeScript 1.3 = error

I have just installed VS2015 Preview. I created a MVC project. I added a new typescript file. I have tried to compile and I got:
The "TypeScript.Tasks.VsTsc" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.tasks.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. WebApplication1
I have tried to search for TypeScript.tasks.dll and I only found:
c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\TypeScript.Tasks.dll
and
c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript\TypeScript.Tasks.dll
How to make it work?
It helped to install TypeScript 1.3 for Visual Studio 2013 after the installation of the Visual Studio 2015. Strange...
There indeed seems something wrong with the installer for the TypeScript 1.3 powertool, I found that using the repair option in Add/Remove Programs fixed the install in most cases.

Visual Studio unable to read the project file (anymore)

Ever since my latest windows update, (which system restore is failing to undo) I can't load any projects with visual studio 2010. The project are greyed out (unavailable) and when I try to reload them I get the error:
C:\Users\Benoit\Documents\Visual Studio 2010\Projects\Test123\Test123\Test123.csproj : error : Unable to read the project file 'Test123.csproj'. Could not load file or assembly 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I tried creating new projects: same error
I tried creating different type of projects (command prompt, silverlight, windows phone): same error
Deleting the .suo and .user files did not change anything
I did not move the projects
Using Visual Studio 2010 with Windows Vista
It looks like the Global Assembly Cache (GAC) is messed up, or possibly the update has done something with the Microsoft.Build assembly file itself.
Try repairing .NET 4.0, and if that does not work you can try completely uninstalling and reinstalling the framework.

unable to load Assembly

I'm getting a strange error from my VisualStudio 2008 installation in Windows 7 and I wonder whether anyone knows how to fix that:
Unable to read the project file
"cs.proj". Could not load file or
assembly Microsoft.Build.Engine,
Version=3.5.0.0, Culture=neutral,
[...] System cannot find the file
specified.
`
I checked: .Net 3.5 is installed. So does anyone know what that means?
Thanks ;)
Try running gacutil -l to check if the MSBuild assemblies are installed
I found a thread on social.msdn.microsoft.com, http://social.msdn.microsoft.com/Forums/en/vssetup/thread/59fa45ee-ac51-4325-83fa-26389a33c22f
Iе offers that the .NET install might be corrupted and suggests uninstall .NET and do a full 3.5 SP1 install.
My IT department did a windows update and it interrupted my VS install with the "MSBuild assembly not found", and I have to wait for them to fix it because I don't have install rights.
Let me know if this works.

How do I build IronRuby on Visual C# 2008 Express Edition?

From the docs it should be possible. I built it on VS 2008 myself - so the source (Sep 8 Master) is okay.
I'm trying to build it now with VS Express Edition on this machine. Installed 4.0 Framework Beta 1. Open the Ruby.sln file ; the IDE won't open any of the .csproj files in the solution
Unable to read project file '<something>.csproj
Path to Framework\v4.0..\Microsoft.Common.Targets(2893,9): The attribute "Keep Duplicate Outputs" in element <Target> is unrecognized.
I tried to remove the offending attribute from the above file. The csproj files then load but result in build errors of the form
Error 54 The "Microsoft.Build.Tasks.Message" task could not be loaded from the assembly Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available. IronRuby.Tests
You can't build 4.0 projects with 2008
For that you need 2010 beta1 (it's a free download)
Or you need to install .NET 3.5 on your machine and try again with 2008. That does work for me but I don't have an express edition.
Also I generally tend to build using Rake (i don't have to open a visual studio session for that).
to do that (build with rake) do the following
download the ruby 1.8 installer from ruby-lang.org
install ruby 1.8
gem install pathname2
make sure you have .NET 3.5 and the windows SDK (resgen.exe and csc.exe) must both exist on your system and their paths have to be added to the %PATH% variable.
set %MERLIN_ROOT% = C:\path\to\ironruby_clone\Merlin\Main
build a debug version
rake compile
build a release version
rake compile configuration=release
to include the ironpython binaries in your release build too.
rake compile:all configuration=release

Resources