处理模板'Entity.tt'时发生了一个或多个错误。 错误:尝试编译时抛出异常 转换代码。抛出以下异常: System.ArgumentException:空路径名不合法。
任何人都知道可能会发生什么?
我在VS 2015中创建了一个新的类项目。添加了<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
的nuget。下载EF Tools的VSIX文件并安装它们。然后我关闭所有内容,重新启动并转到项目的实体框架工具,并选择逆向工程师。它开始经历扫描数据库的过程,然后因此错误而停止。
我尝试以管理员身份运行,以普通用户身份运行,重新启动计算机,似乎没有任何效果(还)。
有什么建议吗?
完整堆栈跟踪:
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)
答案 0 :(得分:1)
您应该只是VS 2015附带的官方EF工具,并使用数据库中的&#34; Code First&#34;功能在&#34;添加EDM&#34;向导,或使用EF反向POCO模板 - EF Power Tools反向引擎不适用于VS 2015,不受支持。
答案 1 :(得分:1)