Keith Barrows
Keith Barrows

Reputation: 25308

Entity Framework Tools Errors on Reverse Engineer Code First

One or more errors occurred while processing template 'Entity.tt'. error : An exception was thrown while trying to compile the transformation code. The following Exception was thrown: System.ArgumentException: Empty path name is not legal.

Anyone know what might be going on?

I created a new class project in VS 2015. Added the nuget for <package id="EntityFramework" version="6.1.3" targetFramework="net452" />. Downloaded the VSIX file for the EF Tools and installed them. Then I shut everything down, restarted and went to the Entity Framework tools for the project and selected Reverse Engineer. It started going through the process of scanning the database then just stopped with this error.

I've tried running as admin, running as a normal user, rebooting the machine and nothing seems to have worked (yet).

Any suggestions?

Full Stack Trace:

One or more errors occurred while processing template 'Entity.tt'.
error : An exception was thrown while trying to compile the transformation code. The following Exception was thrown:
System.ArgumentException: Empty path name is not legal.
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
   at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
   at Microsoft.VisualStudio.TextTemplating.CompilerBridge.<>c.<.ctor>b__15_0(String x)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.<UnionIterator>d__66`1.MoveNext()
   at System.Linq.Enumerable.<UnionIterator>d__66`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
   at Microsoft.CodeAnalysis.ImmutableArrayExtensions.AsImmutableOrEmpty[T](IEnumerable`1 items)
   at Microsoft.CodeAnalysis.Compilation.ValidateReferences[T](IEnumerable`1 references)
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1 references)
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable`1 newReferences)
   at Microsoft.VisualStudio.TextTemplating.CompilerBridge.PrepareNewCompilation()
   at Microsoft.VisualStudio.TextTemplating.CompilerBridge.Compile()
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source, String inputFile, IEnumerable`1 references, Boolean debug, SupportedLanguage language, String compilerOptions)

Upvotes: 0

Views: 679

Answers (2)

Keith Barrows
Keith Barrows

Reputation: 25308

  • The EF Power Tools Beta do work in VS2015: Installing EF Power Tools into VS2015
  • The problem is an update in the .NET framework. Version 4.5.1 will work. Version 4.5.2 and later had a breaking change for the power tools. Easiest solution is to dial your project back to the 4.5.1 framework, reverse engineer the database, dial your version back to where you need/want it.

Upvotes: 1

ErikEJ
ErikEJ

Reputation: 41779

You should just the official EF Tools, that are included with VS 2015, and use the "Code First from Database" feature in the "Add EDM" wizard, or use the EF Reverse POCO template - EF Power Tools reverse engineeer does not work with VS 2015 and is not supported.

Upvotes: 1

Related Questions