处理模板时会发生一个或多个错误' Entity.tt'

时间:2017-11-14 09:45:29

标签: visual-studio entity-framework

使用Microsoft Visual Studio Tools for Applications 2015,我安装了EF Power Tools,如Installing EF Power Tools into VS2015

之后我尝试运行EF Reverse工程代码第一种方法,但我收到了问题并从Visual Studio 2015 Update 2 breaks EF reverse code engineer vsix解决了

当我这样做时,我现在遇到问题处理模板时出现了一个或多个错误' Entity.tt'。 为此我跟着One or more errors occurred while processing template ‘Entity.tt’. 我甚至添加了

Trusted_Connection=False;Persist Security Info=True

在web.config中,在高级选项卡中更改了持久安全信息=真,但问题仍然没有得到解决,我遇到与标题相同的问题。

需要帮助/建议。

visual studio输出窗口出现的detiled错误。

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)

需要帮助/建议

1 个答案:

答案 0 :(得分:1)

我的解决方法如下:

  1. 右键单击该项目,打开属性。
  2. 将目标框架更改为.NET Framework 4
  3. 重新运行反向工程师代码优先脚本。
  4. 重新打开项目属性,将Target Framework更改回您希望的内容