2016-02-25 67 views
2

在Windows 10 x64機器上運行的VS2015中,在嘗試構建.net core Web項目時出現錯誤。需要安裝Dnx Runtime軟件包

The Dnx Runtime package needs to be installed. See output window for more details 

這裏是輸出窗口日誌(只相關部分)

1>Done building target "BeforeCompile" in project "WebApplication1.xproj". 
1>  Target "_TimeStampBeforeCompile" skipped, due to false condition; ('$(RunPostBuildEvent)'=='OnOutputUpdated' or ('$(RegisterForComInterop)'=='true' and '$(OutputType)'=='library')) was evaluated as (''=='OnOutputUpdated' or (''=='true' and 'Library'=='library')). 
1>  1> 
1>Target "GetRuntimeToolingPathTarget" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets" from project "C:\Users\v-prchep\Documents\Visual Studio 2015\Projects\WebApplication1\src\WebApplication1\WebApplication1.xproj" (target "CoreCompile" depends on it): 
1>  Using "GetRuntimeToolingPath" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.Tasks.dll". 
1>  Task "GetRuntimeToolingPath" 
1>  Done executing task "GetRuntimeToolingPath". 
1>  Using "Error" task from assembly "Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". 
1>  Task "Error" 
1>  1> 
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets(126,5): error : The Dnx Runtime package needs to be installed. See output window for more details. 
1>  Done executing task "Error" -- FAILED. 
1>  1> 
1>Done building target "GetRuntimeToolingPathTarget" in project "WebApplication1.xproj" -- FAILED. 
1>  1> 
1>Target "_CheckForCompileOutputs" in file "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\Users\v-prchep\Documents\Visual Studio 2015\Projects\WebApplication1\src\WebApplication1\WebApplication1.xproj" (target "_CleanGetCurrentAndPriorFileWrites" depends on it): 
1>  1> 
1>Done building target "_CheckForCompileOutputs" in project "WebApplication1.xproj". 
1>  Target "_SGenCheckForOutputs" skipped, due to false condition; ('$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')) was evaluated as ('Off' == 'On' or (''!='' and 'Off' == 'Auto')). 
1>  1> 
1>Target "_CleanGetCurrentAndPriorFileWrites" in file "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\Users\v-prchep\Documents\Visual Studio 2015\Projects\WebApplication1\src\WebApplication1\WebApplication1.xproj" (target "_CleanRecordFileWrites" depends on it): 
1>  Task "ReadLinesFromFile" 
1>  Done executing task "ReadLinesFromFile". 
1>  Using "ConvertToAbsolutePath" task from assembly "Microsoft.Build.Tasks.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". 
1>  Task "ConvertToAbsolutePath" 
1>  Done executing task "ConvertToAbsolutePath". 
1>  Task "FindUnderPath" 
1>   Comparison path is "C:\Users\v-prchep\Documents\Visual Studio 2015\Projects\WebApplication1\src\WebApplication1". 
1>  Done executing task "FindUnderPath". 
1>  Task "FindUnderPath" 
1>   Comparison path is "..\..\artifacts\bin\WebApplication1\". 
1>  Done executing task "FindUnderPath". 
1>  Task "FindUnderPath" 
1>   Comparison path is "..\..\artifacts\obj\WebApplication1\Debug\". 
1>  Done executing task "FindUnderPath". 
1>  Task "RemoveDuplicates" 
1>  Done executing task "RemoveDuplicates". 
1>  1> 
1>Done building target "_CleanGetCurrentAndPriorFileWrites" in project "WebApplication1.xproj". 
1>  1> 
1>Target "_CleanRecordFileWrites" in file "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\Users\v-prchep\Documents\Visual Studio 2015\Projects\WebApplication1\src\WebApplication1\WebApplication1.xproj" (target "CoreBuild" depends on it): 
1>  Task "RemoveDuplicates" 
1>  Done executing task "RemoveDuplicates". 
1>  Task "MakeDir" 
1>  Done executing task "MakeDir". 
1>  Task "WriteLinesToFile" 
1>  Done executing task "WriteLinesToFile". 
1>  1> 
1>Done building target "_CleanRecordFileWrites" in project "WebApplication1.xproj". 
1> 
1>Build FAILED. 
1> 
1>Time Elapsed 00:00:00.02 
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== 

去日誌後面,我檢查Microsoft.DNX.targets文件,發現這條線

<Error Text="The Dnx Runtime package needs to be installed. See output window for more details." Condition="!Exists('$(RuntimeToolingExe)')" /> 

好像它試圖從$(RuntimeToolingExe)找出dnx路徑,但我無法確定它正在被設置的位置。

注:dnx運行時已安裝,我能夠使用從運行命令提示符應用以下

dnx web 

應用程序運行正常使用此命令。我相信這是VS2015模具的一個問題,我無法想象。你能幫我解決這個問題嗎?

PS:按照this SO thread提供的所有步驟似乎沒有任何工作。

回答

4

一旦我卸載styleCop,問題終於解決了。好像StyleCop正在重寫Visual Studio正在尋找的dnx路徑。然而,這只是一個猜測,我不確定它爲什麼會奏效!

+0

我一直都有這個相同的問題。我設法跟蹤到Microsoft.DNX.targets的問題。 RuntimeToolingDirectory應設置爲dnx路徑,並使用global.json中的版本/運行時等來確定正確的運行時。例如「%USERPROFILE%\ .dnx \ runtimes \ dnx-clr-win-x86.1.0.0-rc1-update2」由於某種原因,安裝了stylecop,它只是使用版本名稱,例如「1.0.0-RC1-UPDATE2」。我絲毫不知道爲什麼,但非常感謝你指點我stylecop。在一百萬年內不會想到這一點。 – Mark

+0

我發現奇怪的是,當我開始一個* Empty *項目時,我只得到這個條件。如果我選擇* Web API *或* Web Application *(幾乎相同,API有視圖??),那麼即使安裝了StyleCop,也不會出現此類錯誤。忙於安裝StyleCop,看看我是否可以工作*空*。 ReSharper的StyleCop擴展套件更適合我,因爲它是實時的。 – ProfK

+0

我的意思是「繁忙的UNinstalling StyleCop ...」。它沒有幫助。但在我的'global.json'中,它只有版本名稱: 「sdk」:{ 「version」:「1.0.0-rc1-update1」 }我想知道爲什麼我在'update1'昨天運行VS2015更新2後。 – ProfK