zoukankan      html  css  js  c++  java
  • Visual Studio 2015无法进行Package Restore的原因和解决方案

    这篇文章是记录在我的当前电脑上面,安装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)运行的。

    image

    按照默认的设置安装完成后,启动Visual Studio 2015,创建了一个最简单的应用程序,但是无法编译通过,查看输出窗口,得到如下的错误消息

    PATH=. ode_modules.bin;C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEExtensionsMicrosoftWeb ToolsExternal;%PATH%;C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEExtensionsMicrosoftWeb ToolsExternalgit
    C:Userschenxizhang.dnx untimesdnx-clr-win-x86.1.0.0-beta7indnx.exe "C:Userschenxizhang.dnx untimesdnx-clr-win-x86.1.0.0-beta7inlibMicrosoft.DNX.PackageManagerMicrosoft.DNX.PackageManager.dll" restore "c:userschenxizhangdocumentsvisual studio 2015ProjectsConsoleApp1srcConsoleApp1" -s "C:Program Files (x86)Microsoft Web ToolsDNU"
    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 [HKLMSoftwareMicrosoftFusion!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 [HKLMSoftwareMicrosoftFusion!EnableLog].

    看这个错误提示,是因为找不到对应的dnx(运行时)中的Package Manager这个组件。果然如此吗?当前我的电脑上面,已经安装了好几个runtime(注意,这是我自己手工安装的,前期做其他的实验。Visual Studio 2015在安装的过程中也会自己安装dnvm和对应的dnx)

    image

    Visual Studio 2015默认会调用最新版本的runtime(目前是1.0.0-beta 7),并且尝试用它进行Package Restore。我找到对应的目录中去看,确实没有Microsoft.DNX.PackageManager这个文件夹。

    image

    但是奇怪的是,稍早的版本(例如1.0.0-beta 5)确是存在这个目录和对应的DLL

    image

    解决方案

    目前尚不清楚为什么beta7反而有这个问题,但要解决这个问题,暂时先用beta 5我觉得也是可以接受的

    image

    image

    为了简便起见,我们也可以将其他的runtime先删除掉,只留下beta5。这样就不需要每个项目都去设置了。

    image

    当然,相信以后1.0.0正式发布之后,这些问题是可以解决掉的

  • 相关阅读:
    新巴巴运动网 项目第二天
    新巴巴运动网 项目第一天
    pandas.read_csv()参数(转载)
    from sklearn.datasets import make_classification创建分类数据集
    【剑指offer】08二叉树的下一个节点,C++实现
    【剑指offer】滑动窗口的最大值,C++实现
    【剑指offer】找出数组中任意重复的数字(不修改数组),C++实现
    步入element-ui踩坑记
    步入vue.js踩坑记
    nvm安装与使用
  • 原文地址:https://www.cnblogs.com/chenxizhang/p/4822891.html
Copyright © 2011-2022 走看看