Azure应用程序服务生成失败,原因是错误MSB3191:无法创建目录

Azure应用程序服务生成失败,原因是错误MSB3191:无法创建目录,azure,razor,msbuild,azure-web-app-service,.net-5,Azure,Razor,Msbuild,Azure Web App Service,.net 5,平台:Azure应用程序服务 部署:本地Git 版本:.NET 5 将更新(git推送到Azure中的远程本地git).NET 5 Razor Pages应用程序部署到Azure应用程序服务时,KUDU构建失败,错误如下。我可以通过使用Azure门户中的控制台手动删除整个/obj目录来解决这个问题,然后构建成功。但理想情况下,这并不是每次我需要推送更新时都需要的。有没有一种简单的方法来防止这个错误 “git push”到远程后终端出错: (我提前表示歉意。这是我在stackoverflow上发布

平台:Azure应用程序服务

部署:本地Git

版本:.NET 5

将更新(git推送到Azure中的远程本地git).NET 5 Razor Pages应用程序部署到Azure应用程序服务时,KUDU构建失败,错误如下。我可以通过使用Azure门户中的控制台手动删除整个/obj目录来解决这个问题,然后构建成功。但理想情况下,这并不是每次我需要推送更新时都需要的。有没有一种简单的方法来防止这个错误

“git push”到远程后终端出错: (我提前表示歉意。这是我在stackoverflow上发布的第一个问题)

1。检查文件夹权限

二,。以管理员身份打开
cmd
工具,然后
重新运行您的命令

如果在VisualStudio工具中使用命令,还需要以管理员身份运行VisualStudio

remote: RazorCoreGenerate:
remote:   Removing directory "obj\Release\net5.0\Razor\".
remote:   Creating directory "obj\Release\net5.0\Razor\Areas\Identity\Pages\Account\".
remote: D:\Program Files (x86)\dotnet\sdk\5.0.201\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.CodeGeneration.targets(146,5): error MSB3191: Unable to create directory "obj\Release\net5.0\Razor\Areas\Identity\Pages\Account\". Could not find a part of the path 'obj\Release\net5.0\Razor\Areas\Identity\Pages\Account\'. [D:\home\site\repository\abc.csproj]
remote: Done Building Project "D:\home\site\repository\abc.csproj" (default targets) -- FAILED.
remote:
remote: Build FAILED.
remote:
remote: "D:\home\site\repository\abc.csproj" (default target) (1:7) ->
remote: (RazorCoreGenerate target) ->
remote:   D:\Program Files (x86)\dotnet\sdk\5.0.201\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Microsoft.NET.Sdk.Razor.CodeGeneration.targets(146,5): error MSB3191: Unable to create directory "obj\Release\net5.0\Razor\Areas\Identity\Pages\Account\". Could not find a part of the path 'obj\Release\net5.0\Razor\Areas\Identity\Pages\Account\'. [D:\home\site\repository\abc.csproj]
remote:
remote:     0 Warning(s)
remote:     1 Error(s)
remote:
remote: Time Elapsed 00:01:54.09
remote: Failed exitCode=1, command="D:\Program Files (x86)\MSBuilds\16.8.3\MSBuild\Current\Bin\MSBuild.exe" /restore "D:\home\site\repository\abc.csproj" /p:DeployOnBuild=true /p:configuration=Release /p:publishurl="D:\local\Temp\8d9118005db4f8f"
remote: An error has occurred during web site deployment.