Visual Studio 2015无法进行Package Restore的原因和解决方案
2015-09-20 09:44
369 查看
这篇文章是记录在我的当前电脑上面,安装Visual Studio 2015 Community Edition出现的无法进行Package Restore的问题,很可能在你的电脑上面无法重现。我的环境是
1.Windows 7 x64
2.已经安装了Visual Studio 2013
3.已经手工地安装过dnvm 和dnx
按照默认的设置安装完成后,启动Visual Studio 2015,创建了一个最简单的应用程序,但是无法编译通过,查看输出窗口,得到如下的错误消息
看这个错误提示,是因为找不到对应的dnx(运行时)中的Package Manager这个组件。果然如此吗?当前我的电脑上面,已经安装了好几个runtime(注意,这是我自己手工安装的,前期做其他的实验。Visual Studio 2015在安装的过程中也会自己安装dnvm和对应的dnx)
Visual Studio 2015默认会调用最新版本的runtime(目前是1.0.0-beta 7),并且尝试用它进行Package Restore。我找到对应的目录中去看,确实没有Microsoft.DNX.PackageManager这个文件夹。
但是奇怪的是,稍早的版本(例如1.0.0-beta 5)确是存在这个目录和对应的DLL
为了简便起见,我们也可以将其他的runtime先删除掉,只留下beta5。这样就不需要每个项目都去设置了。
当然,相信以后1.0.0正式发布之后,这些问题是可以解决掉的
1.Windows 7 x64
2.已经安装了Visual Studio 2013
3.已经手工地安装过dnvm 和dnx
问题现象:
为了更好地了解和学习一下最新的ASP.NET 5 , MVC 6等一些特性,在当前电脑上面安装了Visual Studio 2015 Community Edition。安装之前,确认过它是可以与当前的Visual Studio 2013并行(Side by side)运行的。按照默认的设置安装完成后,启动Visual Studio 2015,创建了一个最简单的应用程序,但是无法编译通过,查看输出窗口,得到如下的错误消息
PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\git
C:\Users\chenxizhang\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta7\bin\dnx.exe "C:\Users\chenxizhang\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta7\bin\lib\Microsoft.DNX.PackageManager\Microsoft.DNX.PackageManager.dll" restore "c:\users\chenxizhang\documents\visual studio 2015\Projects\ConsoleApp1\src\ConsoleApp1" -s "C:\Program Files (x86)\Microsoft Web Tools\DNU"
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DNX.PackageManager' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.DNX.PackageManager'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.Dnx.Runtime.Loader.LoadContext.Load(AssemblyName assemblyName)
at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
C:\Users\chenxizhang\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta7\bin\dnx.exe "C:\Users\chenxizhang\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta7\bin\lib\Microsoft.DNX.PackageManager\Microsoft.DNX.PackageManager.dll" restore "c:\users\chenxizhang\documents\visual studio 2015\Projects\ConsoleApp1\src\ConsoleApp1" -s "C:\Program Files (x86)\Microsoft Web Tools\DNU"
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DNX.PackageManager' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.DNX.PackageManager'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.Dnx.Runtime.Loader.LoadContext.Load(AssemblyName assemblyName)
at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
看这个错误提示,是因为找不到对应的dnx(运行时)中的Package Manager这个组件。果然如此吗?当前我的电脑上面,已经安装了好几个runtime(注意,这是我自己手工安装的,前期做其他的实验。Visual Studio 2015在安装的过程中也会自己安装dnvm和对应的dnx)
Visual Studio 2015默认会调用最新版本的runtime(目前是1.0.0-beta 7),并且尝试用它进行Package Restore。我找到对应的目录中去看,确实没有Microsoft.DNX.PackageManager这个文件夹。
但是奇怪的是,稍早的版本(例如1.0.0-beta 5)确是存在这个目录和对应的DLL
解决方案
目前尚不清楚为什么beta7反而有这个问题,但要解决这个问题,暂时先用beta 5我觉得也是可以接受的为了简便起见,我们也可以将其他的runtime先删除掉,只留下beta5。这样就不需要每个项目都去设置了。
当然,相信以后1.0.0正式发布之后,这些问题是可以解决掉的
相关文章推荐
- iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片上下垂直居中对齐
- TCP/IP 协议栈及 OSI 参考模型详解
- Aizu 2249 Road Construction(SPFA算法变形,好题)
- 排序算法
- 代码语言编写技巧
- hdu(2546)——饭卡(背包dp)
- 欧拉函数
- Mysql学习笔记(四)聊聊数据库索引
- C++ 使用模板实现单例模式
- SQLite3使用方法大全(四)之数据库创建、附加、分离
- s5pv210的定时器
- 0916 编程实验一 词法分析程序
- 七个对我最好的职业建议(精简版)
- Myeclipse 破解
- jquery学习笔记(一)—基础语法
- c/c++/boost字符串的学习
- ZOJ 3641 Information Sharing
- Ubuntu update appear GPG problem
- 浅谈IT
- Servlet初始化、运行、销毁全部过程