2
votes

Ideally I would like to install Visual Studio 2015 Tools for Unity which includes .NET 3.5 Subset. But .NET 3.5 will do.

Target Dropdown

When I try and build a project in VSTS I get the following build error:

[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.

I found the following question: VSTS Hosted Build .Net Framework 4.6.2

But it seems that the solution there was to install the targeted framework on the machine the agent runs on. However I am using the Hosted agent in VSTS.

I assume I can find the target packs here: https://www.microsoft.com/net/download/visual-studio-sdks but there is no way of installing them on the hosted agent machine.

Can I make this work without creating my own agent?

1

1 Answers

5
votes

Try adding a reference to the .NET 3.5 reference assemblies location in your .csproj file.

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

Reference: Cannot find reference assemblies for .NET 3.5 or lower using core msbuild