我有一个 .Net Framework 4.8 应用程序,解决方案中有多个项目。 主项目 (.csproj) - “项目 A”的调试和发布配置的平台目标为“x86”,而其他项目的调试和发布配置的平台目标为“任何 CPU”。解决方案构建(编译)在 Visual Studio 中很好,但是当我尝试使用 VSBuild@1 任务创建和运行 YAML 构建管道时,它失败并出现错误。这些错误是由以“项目 A”作为引用的测试项目引发的,抛出错误就像未添加“项目 A”作为引用一样。但添加了项目 A 作为测试项目的参考。
顺便说一句,我对 YAML 管道不熟悉,但我相信 YAML 管道非常适合 .net 应用程序。
抛出的错误都是以下类型: 错误 CS0234:命名空间“xx.xx.xx.ProjectA”中不存在类型或命名空间名称“MessageHandler”(是否缺少程序集引用?) “Build-Windows”是一个 Windows 自托管代理,它是 Windows Server 2019 操作系统。我已经尝试了很多方法来解决,但没有运气。我缺少什么?任何帮助将非常感激! 我的 YAML 管道如下所示:
trigger:
- none
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
pool: Build-Windows
steps:
- task: NuGetToolInstaller@1
displayName: ⬇ NuGet - Install
inputs:
versionSpec:
checkLatest: true
- task: NuGetCommand@2
displayName: 🔄 NuGet - Restore
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'config'
nugetConfigPath: NuGet.Config
- task: VSBuild@1
displayName: 🏗 Build
inputs:
solution: '$(solution)'
msbuildArgs: '/p:OutDir=$(Build.ArtifactStagingDirectory)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
clean: true
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
displayName: ⬆ Publish Artifacts
inputs:
ArtifactName: Package
TargetPath: $(Build.ArtifactStagingDirectory)
我尝试更改目标平台并多次更改 YAML 构建管道,但没有成功。