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

时间:2021-07-30 22:09:08

标签: asp.net-mvc azure azure-functions azure-web-app-service github-actions

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

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

Asure Deployment Center

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.

我该如何解决这个错误:

<块引用>

项目中不存在目标“pipelinePreDeployCopyAllFilesToOneFolder”。

1 个答案:

答案 0 :(得分:0)

我自己以前从未见过这个错误,但我对我们的工具进行了研究,发现我们以前也遇到过类似的问题。问题是因为该项目是作为 .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)

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