无法从assembly'NuGet.VisualStudio'加载类型'NuGet.NuGetConstants'。 [英] Could not load type 'NuGet.NuGetConstants' from assembly'NuGet.VisualStudio'.

查看:103
本文介绍了无法从assembly'NuGet.VisualStudio'加载类型'NuGet.NuGetConstants'。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


   我面临以下问题,VS2015中的Code First Reverse Engineering针对SQL Server 2012数据库运行。


问题详情:


System.TypeLoadException:无法从程序集"NuGet.VisualStudio"加载类型"NuGet.NuGetConstants"。

   at System.RuntimeTypeHandle.GetTypeByName(String name,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMarkHandle stackMark,IntPtr pPrivHostBinder,Boolean loadTypeFromPartialName,ObjectHandleOnStack type)

   at System.RuntimeTypeHandle.GetTypeByName(String name,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean loadTypeFromPartialName)

   at System.RuntimeType.GetType(String typeName,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMark& stackMark)

   at System.Type.GetType(String typeName,Boolean throwOnError)

  在Microsoft.DbContextPackage.Extensions.ProjectExtensions.InstallPackage(Project project,String packageId)

  在Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(项目项目)



处理模板'Entity.tt'时出现一个或多个错误。

error:尝试编译转换代码时抛出异常。抛出以下异常:
$
System.ArgumentException:空路径名称不合法。

   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)

  在System.IO.FileStream..ctor(字符串路径,FileMode模式,FileAccess访问,FileShare共享)

  在System.IO.File.OpenRead(String path)

  在Roslyn.Utilities.FileUtilities.OpenFileStream(String path)

  在Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path,MetadataReferenceProperties属性,DocumentationProvider文档)

  在Microsoft.VisualStudio.TextTemplating.CompilerBridge。<> c。< .ctor> b__15_0(String x)

  在System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()

  在System.Linq.Enumerable。< UnionIterator> d__66`1.MoveNext()

  在System.Linq.Enumerable。< UnionIterator> d__66`1.MoveNext()

  在System.Linq.Buffer`1..ctor(IEnumerable`1来源)

  在System.Linq.Enumerable.ToArray [TSource](IEnumerable`1来源)

   at System.Collections.Immutable.ImmutableArray.CreateRange [T](IEnumerable`1 items)

  在Microsoft.CodeAnalysis.ImmutableArrayExtensions.AsImmutableOrEmpty [T](IEnumerable`1 items)

  在Microsoft.CodeAnalysis.Compilation.ValidateReferences [T](IEnumerable`1引用)

  在Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1引用)

  在Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable`1 newReferences)

  在Microsoft.VisualStudio.TextTemplating.CompilerBridge.PrepareNewCompilation()

  在Microsoft.VisualStudio.TextTemplating.CompilerBridge.Compile()

  在Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source,String inputFile,IEnumerable`1 references,Boolean debug,SupportedLanguage language,String compilerOptions)



System.TypeLoadException :无法从程序集"NuGet.VisualStudio"加载类型"NuGet.NuGetConstants"。

   at System.RuntimeTypeHandle.GetTypeByName(String name,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMarkHandle stackMark,IntPtr pPrivHostBinder,Boolean loadTypeFromPartialName,ObjectHandleOnStack type)

   at System.RuntimeTypeHandle.GetTypeByName(String name,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMark& stackMark,IntPtr pPrivHostBinder,Boolean loadTypeFromPartialName)

   at System.RuntimeType.GetType(String typeName,Boolean throwOnError,Boolean ignoreCase,Boolean reflectionOnly,StackCrawlMark& stackMark)

   at System.Type.GetType(String typeName,Boolean throwOnError)

  在Microsoft.DbContextPackage.Extensions.ProjectExtensions.InstallPackage(Project project,String packageId)

  在Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(项目项目)



处理模板'Entity.tt'时出现一个或多个错误。

error:尝试编译转换代码时抛出异常。抛出以下异常:
$
System.ArgumentException:空路径名称不合法。

   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)

  在System.IO.FileStream..ctor(字符串路径,FileMode模式,FileAccess访问,FileShare共享)

  在System.IO.File.OpenRead(String path)

  在Roslyn.Utilities.FileUtilities.OpenFileStream(String path)

  在Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path,MetadataReferenceProperties属性,DocumentationProvider文档)

  在Microsoft.VisualStudio.TextTemplating.CompilerBridge。<> c。< .ctor> b__15_0(String x)

  在System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()

  在System.Linq.Enumerable。< UnionIterator> d__66`1.MoveNext()

  在System.Linq.Enumerable。< UnionIterator> d__66`1.MoveNext()

  在System.Linq.Buffer`1..ctor(IEnumerable`1来源)

  在System.Linq.Enumerable.ToArray [TSource](IEnumerable`1来源)

   at System.Collections.Immutable.ImmutableArray.CreateRange [T](IEnumerable`1 items)

  在Microsoft.CodeAnalysis.ImmutableArrayExtensions.AsImmutableOrEmpty [T](IEnumerable`1 items)

  在Microsoft.CodeAnalysis.Compilation.ValidateReferences [T](IEnumerable`1引用)

  在Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable`1引用)

  在Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable`1 newReferences)

  在Microsoft.VisualStudio.TextTemplating.CompilerBridge.PrepareNewCompilation()

  在Microsoft.VisualStudio.TextTemplating.CompilerBridge.Compile()

  在Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source,String inputFile,IEnumerable`1 references,Boolean debug,SupportedLanguage language,String compilerOptions)



请帮助解决此问题...

解决方案

从中安装 EntityFramework Nuget Package Manager,它正在为我工​​作......




Hi

    I am facing below issue while Code First Reverse Engineering in VS2015 running against SQL Server 2012 database.

Issue Details:

System.TypeLoadException: Could not load type 'NuGet.NuGetConstants' from assembly 'NuGet.VisualStudio'.
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at Microsoft.DbContextPackage.Extensions.ProjectExtensions.InstallPackage(Project project, String packageId)
   at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)

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)

System.TypeLoadException: Could not load type 'NuGet.NuGetConstants' from assembly 'NuGet.VisualStudio'.
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at Microsoft.DbContextPackage.Extensions.ProjectExtensions.InstallPackage(Project project, String packageId)
   at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)

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)

Please help on this issue...

解决方案

After installing EntityFramework package from Nuget Package Manager and it's working for me...


这篇关于无法从assembly'NuGet.VisualStudio'加载类型'NuGet.NuGetConstants'。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆