Failed to build .NET Framework 3.5 targeted class library using .NET 5.0 SDK.
git clone https://github.com/ganeshnj/DotNet5ReferenceAssemblies
cd DotNet5ReferenceAssemblies
dotnet build
Output
C:\Program Files\dotnet\sdk\5.0.101\Microsoft.Common.CurrentVersion.targets(1180,5): error MSB3644: The reference assemblies for .NETFramework,Version=v3.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [C:\source\repos\DotNet5ReferenceAssemblies\DotNet5ReferenceAssemblies.csproj]
This issues existed previously also which was mitigated using this workaround.
dotnet build should build the project.
I suspect .NET 5 CLI introduces some breaking changes that causes this behavior. If I force 3.1 version of .NET Core SDK, build succeeds.
Branch fix-35-reference-assemblies
global.json
{
"sdk": {
"version": "3.1.101",
"rollForward": "latestFeature"
}
}
โฏ dotnet --list-sdks
3.1.301 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
โฏ [System.Environment]::OSVersion
Platform ServicePack Version VersionString
-------- ----------- ------- -------------
Win32NT 10.0.18363.0 Microsoft Windows NT 10.0.18363.0
VS uses msbuild for building and it's works as expected
Rider also have errors on build SDK-style projects with net35 targets
I've found deferent behaviors:
failed build:

success build:

I've found workaroud
set properties
```` msbuild
````
It looks like that means $(MSBuildFrameworkToolsRoot) was evaluated to ''. That's normally set in Microsoft.NetFramework.CurrentVersion.props, but that wasn't imported because exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.NETFramework.props\ImportBefore') (C:\Users\jangirg\AppData\Local\Microsoft\MSBuild\Current\Microsoft.NETFramework.props\ImportBefore) evaluated to false. Not sure if that's supposed to exist or if one of those properties is set to the wrong value.
@Forgind Try to get a repro going. See what happens if we target netcoreapp3.1
Most helpful comment
I've found workaroud
set properties
$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework.NETFramework\v3.5\Profile\Client
false
```` msbuild
````