这篇文章是记录在我的当前电脑上面,安装Visual Studio 2015 Community Edition出现的无法进行Package Restore的问题,很可能在你的电脑上面无法重现。我的环境是

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].

看这个错误提示,是因为找不到对应的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正式发布之后,这些问题是可以解决掉的

Visual Studio 2015无法进行Package Restore的原因和解决方案的更多相关文章

  1. Visual Studio 2015 新建MVC项目 Package Manager Console不能使用 (HRESULT: 0x80131500)

    Visual studio 2015 突然新建不了MVC项目,报出错误: HRESULT: 0x80131500 在折腾了很长时间,最后在Github上看到这样一个贴 地址:https://githu ...

  2. ASP.NET 5系列教程 (五):在Visual Studio 2015中使用Grunt、Bower开发Web程序

    基于Visual Studio 2015,你可以: 方便的管理前端包,如jQuery, Bootstrap, 或Angular. 自动运行任务,如LESS.JavaScript压缩.JSLint.Ja ...

  3. Grunt和Gulp构建工具在Visual Studio 2015中的高效的应用

    Grunt和Gulp构建工具在Visual Studio 2015中的高效的应用 Grunt和Gulp是Javascript世界里的用来做自动压缩.Typescript编译.代码质量lint工具.cs ...

  4. ASP.NET5之客户端开发:Grunt和Gulp构建工具在Visual Studio 2015中的高效的应用

    Grunt和Gulp是Javascript世界里的用来做自动压缩.Typescript编译.代码质量lint工具.css预处理器的构建工具,它帮助开发者处理客户端开发中的一些烦操重复性的工作.Grun ...

  5. Visual Studio 2015 前端开发工作流

    Visual Studio 2015 CTP 5,全称为 Visual Studio 2015 Community Technology Preview 5,意为社区技术预览版,之前的版本为:Visu ...

  6. Visual Studio 2015 开发 ASP.NET 5 有何变化?

    本篇博文目录: ASP.NET 5 模版 ASP.NET 5 目录结构 前端管理工具 无编译开发 Microsoft Git Provider 智能感知和错误信息 Smart Unit Testing ...

  7. Visual Studio SetSite failed for package [JavaScriptWebExtensionsPackage] 错误解决方案一则

    安装 AspNet5.ENU.RC1.exe Microsoft ASP.NET and Web Tools 2015 (RC) – Visual Studio 2015 打开VS后发生了错误 < ...

  8. 解析Visual Studio 2015促进生产力的10个新功能

    1 性能提示 Performance Tips 当我们想知道执行一段代码所耗费的时间时,需要借助于.NET 框架的Stopwatch类,像下面这样: class Program { static vo ...

  9. Node.js Tools 1.2 for Visual Studio 2015 released

    https://blogs.msdn.microsoft.com/visualstudio/2016/07/28/node-js-tools-1-2-visual-studio-2015/ What ...

随机推荐

  1. sort命令

    1.默认情况下,sort命令,以字母序进行文本排序sort word.txt2.如果想对数字进行排序,可以使用-n参数sort num.txt -n3指定列排序下面是对passwd文件,以冒号(:)进 ...

  2. Linux Shell 编程中的特殊符号

    一.井号 # 1.在脚本文件中对一行进行注释. 2.在引号和\符号后不是注释,只是#号本身: echo "12 # hehe" echo '12 # hehe' echo 12 \ ...

  3. elasticsearch常用的概念整理

    节点node 节点(node)是一个运行着的Elasticsearch实例 集群中一个节点会被选举为主节点(master),它将临时管理集群级别的一些变更,例如新建或删除索引.增加或移除节点等.主节点 ...

  4. Spring的通知(Advice)

    Spring提供了5种Advice类型: Interception Around:JointPoint前后调用 Before:JointPoint前调用 After Returning:JointPo ...

  5. jquery 购物车飞入效果

    github https://github.com/amibug/fly demo https://github.com/amibug/fly

  6. USACO翻译:USACO 2014 FEB SILVER 三题

    USACO 2014 FEB SILVER 一.题目概览 中文题目名称 自动打字 路障 神秘代码 英文题目名称 auto rblock scode 可执行文件名 auto rblock scode 输 ...

  7. canvas :曲线的面积图 加渐变效果

    document.body.innerHTML = '<canvas></canvas>' var cvs = document.querySelector("can ...

  8. 移动开发可能用到的css单位

    众所周知CSS技术我们虽然很熟悉,在使用的过程却很容易被困住,这让我们在新问题出现的时候变得很不利.随着web继续不断地发展,对于新技术新 解决方案的要求也会不断增长.因此,作为网页设计师和前端开发人 ...

  9. 细数iOS上的那些安全防护

    细数iOS上的那些安全防护  龙磊,黑雪,蒸米 @阿里巴巴移动安全 0x00 序 随着苹果对iOS系统多年的研发,iOS上的安全防护机制也是越来越多,越来越复杂.这对于刚接触iOS安全的研究人员来说非 ...

  10. Java工作环境笔记

    环境 1. Jvm最简生存指南: http://www.importnew.com/10127.html 2. 所有路径中,不要出现中文,即使开始的时候,调试Tomcat时,路径有中文也可以,你真不知 ...