我在部署到我已设置的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"我是不是漏掉了一个步骤?我是新手,所以我可能在什么地方忘了一个步骤。非常感谢您的帮助,谢谢!
发布于 2019-07-16 18:23:58
根据此错误消息,很明显您使用的版本是MSBuild 14.0(VS 2015 tools)。
另外,从这条消息中:
缺少项目类型“PackageReference”所需的属性“OutputPath”。
据我所知,PackageReference只适用于MSBuild版本15和更高版本,而不是14.0。因为它来自VS 2017,同时也是MSBuild 15.0。
因此,为了解决这个错误,我建议您尝试使用更新版本:MSbuild 15.0。
你也可以参考这个标签:Missing required property 'OutputPath' for project type 'PackageReference'
编辑:
首先,请确保您的脚本可以在本地的VS2017中成功执行。
然后,如果使用Visual Studio build任务进行构建,则将Visual Studio Version更改为:

或者,如果您使用的是MSBuild任务,则只需更改MSBuild Version

对于我来说,我使用的是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\amd64https://stackoverflow.com/questions/56981899
复制相似问题