gpt4 book ai didi

asp.net-mvc - 如何使用 dotnet 构建 .NET Framework ASP.NET 应用程序

转载 作者:行者123 更新时间:2023-12-05 06:25:42 25 4
gpt4 key购买 nike

我们混合使用了 ASP.NET Core 和 .NET Framework ASP.NET 应用程序。我们混合使用 msbuilddotnet 来构建应用。

我正在尝试全力投入 dotnet,但构建总是抛出以下错误:

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.0.100-preview5-011568\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

现在我只是尝试使用一个非常简单的 dotnet msbuild foo.sln 命令。目前没有标志或任何东西被使用。

我已经在多个 ASP.NET(非 Core)应用程序上尝试过,它们都给出了相同的错误。

最佳答案

对于 ASP.NET Web 应用程序,您需要使用以下代码进行编译。

C:\'Program Files (x86)'\'Microsoft Visual Studio'\[year]\[edition]\MSBuild\Current\Bin\msbuild.exe [project.csproj] /p:VisualStudioVersion=[version] /p:DeployOnBuild=true /p:PublishProfile=[profileName]

您可以在 cmd 或 PowerShell 中运行。根据您的计算机上安装的 Visual Studio 版本和解决方案版本替换标签。

例如:

C:\'Program Files (x86)'\'Microsoft Visual Studio'\2019\Community\MSBuild\Current\Bin\msbuild.exe HelloWorld.csproj /p:VisualStudioVersion=16.0 /p:DeployOnBuild=true /p:PublishProfile=Release

关于asp.net-mvc - 如何使用 dotnet 构建 .NET Framework ASP.NET 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56773889/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com