【问题标题】:.Net Core Website publish Microsoft.WebSite.Publishing.targets.Net 核心网站发布 Microsoft.WebSite.Publishing.targets
【发布时间】:2017-09-18 17:51:47
【问题描述】:

我在 .Net Core 2.0 上。

我创建了一个包含 webapp 和网站的新解决方案。该网站项目包含一个 index.html 和 web.config 文件。

我发布网络应用程序没有问题,但网站给我带来了一些麻烦。

我添加了为 FileSystem 发布方法配置的发布配置文件。

当我在生成的默认 .publishproj 上运行 dotnet publish 时,我收到以下错误消息

error MSB4019: The imported project 
"C:\ProgramFiles\dotnet\sdk\2.0.0\Microsoft\
VisualStudio\v10.5\Web\Microsoft.Web
Site.Publishing.targets" was not found. Confirm that the path in the 
<Import> declaration is correct, and that the file exists on disk.

好的,所以我将 website.publishproj 的值更改为目标文件所在的位置。

<!--<Import 
Project="$(_WebPublishTargetsPath)\Web\Microsoft.WebSite.Publishing.targets" 
/>-->
<Import Project="C:\Program Files 
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\
Microsoft.WebSite.Publishing.targets" />

然后我得到

error MSB3030: Could not copy the file 
"C:\Users\Administrator\AppData\Local\Temp\WebSitePublish\WebSite2-
1026028577\obj\Debug\website.exe" because it was not found. 
[C:\Users\Administrator\Documents\visual studio 
2017\WebSites\WebSite2\website.publishproj]

我可以使用 Visual Studio 发布网站,没有任何问题。我错过了什么?

【问题讨论】:

    标签: web .net-core publishing


    【解决方案1】:

    您似乎正在尝试使用 dotnet CLI 工具发布不受支持的“经典”网站项目。请改用开发人员命令提示符中的msbuild

    【讨论】:

    • 它确实有意义并且有效。我假设可视化 c#“Asp.Net 网站”模板与 dotnet 核心完全兼容。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2016-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-10
    • 1970-01-01
    相关资源
    最近更新 更多