我在部署到已设置的 Azure Web App 资源时遇到问题。我在网上找不到太多有关此错误的信息,因此在此发布...
我有一个 .NET 解决方案,其中包含一个主项目和几个类库项目,我在主项目中引用了这些项目。
由于某种原因,部署失败,因为它没有选择解决方案中的那些 dll 项目。我的代码位于 bitbucket 存储库中,并且我已将其设置为每当我提交到某个分支时就部署到我的 Web 应用程序资源。
但它因以下错误而失败:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
All packages listed in packages.config are already installed.
Invalid restore input. Missing required property 'OutputPath' for project type 'PackageReference'. Input files: D:\home\site\repository\XXXCode\XXXXX.Entities\XXXXX.Entities.csproj.
Failed exitCode=1, command=nuget restore "D:\home\site\repository\XXXCode\XXXCode.sln"
An error has occurred during web site deployment.
Invalid restore input. Missing required property 'OutputPath' for project type 'PackageReference'. Input files: D:\home\site\repository\XXXCode\XXXXX.Entities\XXXXX.Entities.csproj.\r\nD:\Program Files (x86)\SiteExtensions\Kudu\82.10503.3890\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
我在这里错过了一步吗? 我对此很陌生,所以我可能忘记了某个步骤。 非常感谢任何帮助,谢谢!
最佳答案
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
根据此错误消息,显然您使用的版本是MSBuild 14.0(VS 2015工具)。
此外,来自此消息:
Missing required property 'OutputPath' for project type 'PackageReference'.
据我了解,PackageReference
仅适用于 MSBuild 版本 15 及更高版本,而不是 14.0。因为它是 VS 2017 附带的,同时也是 MSBuild 15.0。
因此,为了解决此错误,我建议您尝试使用较新的版本:MSbuild 15.0。
您也可以引用这张票:Missing required property 'OutputPath' for project type 'PackageReference'
编辑:
首先,请确保您的脚本可以在VS2017本地成功执行。
然后,如果您使用 Visual Studio 构建任务进行构建,请将 Visual Studio 版本
更改为:
或者,如果您正在使用其 MSBuild 任务,则只需更改 MSBuild 版本
:
另一方面,如果您在 MSbuild 任务中使用 Specify Location
而不是 Version
,请指定 MSBuild.exe 的位置路径在 MSBuild 15.0 下。对于我来说,我使用的是VS2019,所以MSbuild 16.0的位置是:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe
更新:
由于您使用的是 VS2017,因此您可以使用 MSbuild 15.0 文件路径指定 MSbuild 15.0 的位置:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64
关于c# - Azure Pipeline 部署到 Web 应用服务失败,缺少必需的属性 'OutputPath',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56981899/