【发布时间】:2019-05-14 12:34:23
【问题描述】:
我有一些云服务项目,我正试图将其纳入 CI/CD。当我右键单击来自Visual Studio 的项目并单击Package 时,它会执行我想要的操作。打包命令完成后,我可以在bin\Release文件夹中看到ServiceConfiguration.cscfg和ServiceDefinition.csdef。
如何从 MSBuild 命令行实现相同的目标?我试过了
msbuild.exe
/p:DeployTarget=Package
/p:DeployOnBuild=true
/p:AutomatedBuild=True
/p:configuration=release
/p:outdir="D:\Pub"
/p:targetprofile="Cloud"
/target:Publish
/p:SolutionDir=$/src/mysln/ WorkerRole.ccproj
我得到的是命令完成,我可以在文件夹中看到大约 241 个 dll 和所需的文件。我在命令参数中遗漏了什么吗?请指教
编辑:也参考了官方docs,找不到任何东西
编辑 2:看起来我可以生成包。现在问题是在 VSTS 中执行此操作。构建失败," projectfile="*Undefined*Obfuscator\Maps\
基本上解决方案的路径变得未定义
编辑 3:这是我尝试仅构建 CloudServiceProj 时的错误消息
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5165,5): Error MSB3073: The command "if "Release" == "Debug" goto :exit
"*Undefined*Obfuscator\Tool\CO" projectfile="*Undefined*Obfuscator\Maps
未定义在本地运行良好,因为它在 VS 中有 $(SolutionDir) 变量。不知道怎么处理这里
更新
这是正在使用的 msbuild
更新 4
我尝试按照建议直接构建解决方案,但它有一些 .NET CORE 和 .NET Framework 项目,我收到此错误
C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\Microsoft.NET.Sdk.Publish.targets(163,11): Error MSB4006: There is a circular dependency in the target dependency graph involving target "Publish"..
【问题讨论】:
标签: msbuild azure-devops azure-cloud-services azure-pipelines-build-task