构建 ASP 应用程序并将其部署到 Azure Web 应用程序失败

Build and deploy ASP app to Azure Web App fails

我正在尝试使用 .NET 4.8(这不是 .net 核心应用程序)在 Azure 中为 ASP.NET MVC 5 创建部署

如果我从 Visual Studio 创建 Web 应用程序,则会部署代码。 但是如果我从 GitHub:

设置部署

github 操作失败并出现以下错误:

Run msbuild /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="\published\"
  SugarMonkey -> D:\a\SC601PA-SugarMonkey\SC601PA-SugarMonkey\SugarMonkey\bin\SugarMonkey.dll
  SugarMonkey.Tests -> D:\a\SC601PA-SugarMonkey\SC601PA-SugarMonkey\SugarMonkey.Tests\bin\Debug\SugarMonkey.Tests.dll
  Transformed Web.config using D:\a\SC601PA-SugarMonkey\SC601PA-SugarMonkey\SugarMonkey\Web.Debug.config into obj\Debug\TransformWebConfig\transformed\Web.config.
  Copying all files to temporary location below for package/publish:
  \published\.
D:\a\SC601PA-SugarMonkey\SC601PA-SugarMonkey\SugarMonkey.Tests\SugarMonkey.Tests.csproj : error MSB4057: The target "pipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.
Error: Process completed with exit code 1.

如何解决此错误:

The target "pipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.

我以前没有亲眼见过这个错误,但我对我们的工具进行了研究,发现我们以前遇到过类似的问题。问题是因为该项目是作为 .Net Core 应用程序构建的,并且在重建为 .Net Standard 后得到解决。您是否有可能引用旧的依赖项?

最后,看看这篇文章:https://www.codeproject.com/Tips/1109834/Error-MSB-The-target-Package-does-not-exist-in-t-2#:~:text=%20Error%20MSB4057:%20The%20target%20%22Package%22%20does%20not,for%20this%20entry%20is%20to%20help...%20More

文章解释了可以在 .csproj 中添加以下代码来缓解此问题:

$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)

让我知道这些项目的结果。