Visual studio Visual Studio发布错误“;“生成转换”;任务意外失败

Visual studio Visual Studio发布错误“;“生成转换”;任务意外失败,visual-studio,docker,azure-web-app-service,Visual Studio,Docker,Azure Web App Service,我正在尝试使用VisualStudio2019将一个新的Blazor服务器项目(具有docker支持)发布到Azure应用程序服务容器。它在本地构建并运行良好。当我转到发布时,我收到错误: The "GenerateEnvTransform" task failed unexpectedly. System.IO.DirectoryNotFoundException: Could not find a part of the path '[PathToProject]\obj

我正在尝试使用VisualStudio2019将一个新的Blazor服务器项目(具有docker支持)发布到Azure应用程序服务容器。它在本地构建并运行良好。当我转到发布时,我收到错误:

The "GenerateEnvTransform" task failed unexpectedly.
System.IO.DirectoryNotFoundException: Could not find a part of the path '[PathToProject]\obj\Debug\netcoreapp3.1\PubTmp\EnvironmentWithLocation.transform'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at System.Xml.XmlWriterSettings.CreateWriter(String outputFileName)
   at System.Xml.XmlWriter.Create(String outputFileName, XmlWriterSettings settings)
   at System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options)
   at Microsoft.NET.Sdk.Publish.Tasks.GenerateEnvTransform.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() BenjiWorldServer2       0   
GenerateEnvTransform”任务意外失败。
System.IO.DirectoryNotFoundException:找不到路径“[PathToProject]\obj\Debug\netcoreapp3.1\PubTmp\Environment WithLocation.transform”的一部分。
在System.IO.\uuu Error.WinIOError(Int32 errorCode,字符串maybeFullPath)
在System.IO.FileStream.Init(字符串路径、文件模式、文件访问权限、Int32权限、布尔用户权限、文件共享、Int32缓冲大小、文件选项选项、安全属性secAttrs、字符串msgPath、布尔bFromProxy、布尔useLongPath、布尔checkHost)
位于System.IO.FileStream..ctor(字符串路径、文件模式、文件访问权限、文件共享、Int32 bufferSize、文件选项选项、字符串msgPath、布尔bFromProxy)
位于System.IO.FileStream..ctor(字符串路径、文件模式、文件访问访问、文件共享、Int32 bufferSize、布尔UseAync)
位于System.Xml.XmlWriterSettings.CreateWriter(字符串输出文件名)
在System.Xml.XmlWriter.Create(字符串输出文件名,XmlWriterSettings设置)
位于System.Xml.Linq.XDocument.Save(字符串文件名,SaveOptions)
在Microsoft.NET.Sdk.Publish.Tasks.GenerateEnvTransform.Execute()中
位于Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ItaskeExecutionHost.Execute()
在Microsoft.Build.BackEnd.TaskBuilder.d_u26.MoveNext()BenjiWorldServer2 0

我还尝试了不同的框架版本,包括.NET5。我还尝试将配置从dev更改为release。这只是一个试图设置的简单项目,我没有接触任何默认模板代码文件。我使用的是运行Docker Windows应用程序的Windows 10。

将Docker和vs2019更新为最新版本

我不知道你为什么会犯这个错误。根据您的描述,创建并发布应用程序时,我没有遇到与您相同的错误,因此建议您在更新后重试

提示

确保应用程序服务的版本与项目的版本一致,例如,两者都是.net 5