Visual Studio 2015無法進行Package Restore的原因和解決方案

來源:互聯網
上載者:User

標籤:

這篇文章是記錄在我的當前電腦上面,安裝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的原因和解決方案

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.