Entity Framework An Exception was thrown while running the transformation code

2

I keep getting this error when I add a Entity Data Model to project, which basically is creating a modal for a .mdf file in App_Data folder. It's a WCF project.

I am using VS 2015 community edition and also have Xamarin installed.

I tried to change the .net framework version from 4.5.0 to 4.5.1-2 and 4.6.1, but I keep getting this error. I also installed manually Microsoft.CodeAnalysis package. Tried deleting every thing from packages folder and then restored all the nuget plugin. But everything thing is a fail for me.

Reference to Microsoft.CodeAnalysis is added and its versions is "1.3.1.0"

What I might be doing wrong here?

Error:

Severity Code Description Project File Line Suppression State Error An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.VisualStudio.TextTemplating.CompilerBridge..ctor(String source, Boolean debug, IEnumerable1 references, String cmdLineArguments) at Microsoft.VisualStudio.TextTemplating.CompilerBridge.Create(SupportedLanguage language, String source, Boolean debug, IEnumerable1 references, String cmdLineArguments) at Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source, String inputFile, IEnumerable1 references, Boolean debug, SupportedLanguage language, String compilerOptions) at Microsoft.VisualStudio.TextTemplating.TransformationRunner.LocateAssembly(Boolean cacheAssemblies, String fullClassName, String source, String inputFile, Boolean debug, SupportedLanguage language, IEnumerable1 compilerReferences, String compilerOptions) at Microsoft.VisualStudio.TextTemplating.TransformationRunner.PrepareTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host) === Pre-bind state information === LOG: DisplayName = Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/ LOG: Initial PrivatePath = NULL Calling assembly : Microsoft.VisualStudio.TextTemplating.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\Hitin\AppData\Local\Microsoft\VisualStudio\14.0\devenv.exe.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: The same bind was seen before, and was failed with hr = 0x80131040. 1

c#
entity-framework
visual-studio
wcf
asked on Stack Overflow Aug 20, 2016 by Hitin • edited Aug 22, 2016 by Masoud

2 Answers

0

It's sorted now, looks like xamarin update (may) have corrupted the VS 2015 installation.

Repair doesn't work here.

So the only solution was to upgrade from "VS2015 Community update 2" to "VS2015 Community update 3" , and now both xamarin as well as VS is working just fine.

answered on Stack Overflow Aug 23, 2016 by Hitin
0

Found this answer on developercommunity.visualstudio.com from avatar Kees Alderliesten, maybe it would help for you

as a workaround, you could try to copy both files to \windows\system32 and rename them to $(VSAPPIDDIR)EntityFramework.dll and $(VSAPPIDDIR)Microsoft.Data.Entity.Design.dll (yes, Windows accepts that). It got it working again that way.

answered on Stack Overflow Sep 4, 2019 by chavy

User contributions licensed under CC BY-SA 3.0