如何使用托管代理在VSTS中构建针对.NET 3.5的.csproj?

Sto*_*ler 1 .net continuous-integration unity-game-engine azure-devops azure-pipelines

理想情况下,我想安装包含.NET 3.5子集的Visual Studio 2015 Tools for Unity。但是.NET 3.5可以。

目标下拉

当我尝试在VSTS中构建项目时,出现以下构建错误:

[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1122,5): Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v3.5,Profile=v3.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
Run Code Online (Sandbox Code Playgroud)

我发现以下问题:VSTS托管版本.Net Framework 4.6.2

但似乎解决方案是在代理运行所在的计算机上安装目标框架。但是,我在VSTS中使用托管代理。

我假设可以在以下位置找到目标包:https : //www.microsoft.com/net/download/visual-studio-sdks,但是无法在托管代理计算机上安装它们。

我可以在不创建自己的代理的情况下进行此工作吗?

Nig*_*888 5

尝试在.csproj文件中添加对.NET 3.5参考程序集位置的引用。

<PropertyGroup>
  <FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

参考:使用核心msbuild无法找到.NET 3.5或更低版本的参考程序集