问题描述
由于 Git 子模块上的 $(SolutionDir) 宏,Azure DevOps Pipelines 无法找到项目文件路径。
我在下面为 Solution1.sln 运行构建任务,此解决方案包括从 Git 子模块检出的几个项目。
其中一个 Git 子模块是一个解决方案 (Solution2.sln),它也有从 Git 子模块检出的自己的项目。
当 MSBuild 任务针对 Solution2.sln 运行时,它找不到项目文件路径,因为项目文件 (.csproj) 使用 $(SolutionDir) 在本地工作正常,因为 Visual Studio 知道 $(SolutionDir) = Solution2.sln 路径。
但是,在 Azure DevOps 中,MSBuild 认为 $(SolutionDir) 是 Solution1.sln 路径。
如何强制 Azure DevOps 中的 MSBuild 遵守与当前正在构建的解决方案 (Solution2.sln) 相关的 $(SolutionDir) 宏,而不是作为任务输入传递的解决方案 (Solution1.sln)?>
steps:
- checkout: self
submodules: recursive
persistCredentials: true
- task: VSBuild@1
inputs:
solution: 'Solution1.sln'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
platform: 'Any cpu'
configuration: 'Release'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)