您好
我正在使用Visual Studio 2017构建一个带有c#
应用程序执行OK但是在部署时我在日志文件中收到错误消息 ,在Web发布活动中窗口最后一行显示 (错误MSB3073:命令"" dotnet" exec --runtimeconfig ) 。
我想知道此错误消息的含义
问候
Dean
解决方案
你好Dean ,
欢迎来到MSDN论坛。
您的应用程序目标是 core 2吗?类似于 此问题。
通常, MSB3073表示构建事件中的命令出错。但是对于您的具体情况,似乎是 core 2.0 web-app的问题是由剃刀编译引起的。
请检查 doc :在调用关联的Razor Page或MVC视图时,在运行时编译Razor文件。不支持构建时Razor文件发布。剃刀文件可以选择在发布时编译,并使用预编译工具与应用程序一起部署。
我认为这是导致问题的原因: 在ASP.NET Core 2.0中执行自包含部署(SCD)时,Razor文件预编译不可用。
作为解决方法的解决方法这个:将< MvcRazorCompileOnPublish> false< / MvcRazorCompileOnPublish> 添加到您的xx.csproj文件中。 (将其添加到< PropertyGroup>)
希望它有所帮助。
最好的问候
Lance
Hi there
I am using Visual Studio 2017 building an ASP.core web application with c#
The application executes OK , however at deploy time I get an error message in a log file , in the Web Publish activity window the last line shows ( Error MSB3073: The command ""dotnet" exec --runtimeconfig ) .
I would like to know the meaning of this error message
Regards
Dean
解决方案Hi Dean,
Welcome to MSDN forum.
Is your application target core 2? Something similar to this issue.
Usually, the MSB3073 indicates something is wrong with the command in build-events. But for your specific situation, it seems an issue with core 2.0 web-app which results from razor compilation.
Please check this doc: A Razor file is compiled at runtime, when the associated Razor Page or MVC view is invoked. Build-time Razor file publishing is unsupported. Razor files can optionally be compiled at publish time and deployed with the app—using the precompilation tool.
And I think this is the cause of your issue:Razor file precompilation is unavailable when performing a self-contained deployment (SCD) in ASP.NET Core 2.0.
As a workaround to solve this: Add<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish> into your xx.csproj file. (Add it in a <PropertyGroup>)
Hope it helps.
Best Regards
Lance
更多推荐
Visual Studio 2017错误MSB3073:命令“" dotnet” exec
发布评论