【问题标题】:The Dnx Runtime package needs to be installed需要安装 Dnx Runtime 包
【发布时间】:2016-02-25 08:09:54
【问题描述】:

在 Windows 10 x64 机器上运行的 VS2015 中,我在尝试构建 .net core Web 项目时遇到错误。

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 中提供的所有步骤操作似乎没有任何效果。

【问题讨论】:

    标签: .net visual-studio dnx .net-core dnvm


    【解决方案1】:

    卸载styleCop后问题终于解决了。似乎 StyleCop 覆盖了 Visual Studio 正在寻找的 dnx 路径。然而,这只是一个猜测,我不是特别确定它为什么会起作用!

    【讨论】:

    • 我也遇到了同样的问题。我设法将问题追溯到 Microsoft.DNX.targets。 RuntimeToolingDirectory 应设置为 dnx 路径,并使用 global.json 中的 version/runtime 等来确定正确的运行时。例如"%USERPROFILE%\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2" 由于某些原因安装了 stylecop,它只是使用版本名称,例如“1.0.0-rc1-update2”。我一点也不知道为什么,但非常感谢你指点我 stylecop。一百万年后都不会想到这一点。
    • 我觉得奇怪的是,我只有在启动 Empty 项目时才会出现这种情况。如果我选择 Web APIWeb Application(它们几乎相同,API 有视图??)那么即使安装了 StyleCop,我也不会收到此类错误。忙于安装 StyleCop,看看我能否得到一个工作的 Empty。 ReSharper 的 StyleCop 扩展更适合我,因为它是实时的。
    • 我的意思是,“忙于卸载 StyleCop...”。它没有帮助。但在我的global.json 中,它只有版本名称:"sdk": { "version": "1.0.0-rc1-update1" } 而且,我想知道为什么在运行 VS2015 的更新 2 后我在 update1昨天。
    猜你喜欢
    • 1970-01-01
    • 2022-08-10
    • 1970-01-01
    • 2022-01-04
    • 2020-04-14
    • 2013-04-18
    • 1970-01-01
    • 2018-03-28
    • 2013-01-21
    相关资源
    最近更新 更多