msbuild: Cannot find reference assemblies for .NET 3.5 or lower using core msbuild
dotnet/sdk supports targeting .NET 3.5 just fine if you use desktop msbuild, but it fails to find the reference assemblies using core msbuild. Both desktop and core work fine for NET4.0+.
Steps to reproduce
Create a new project with dotnet new
Change the TargetFramework to net35 or lower
Add <RuntimeIdentifier>win10-x64</RuntimeIdentifier> to the .csproj
dotnet restore
dotnet build
I’ve been seeing this issue since the move to msbuild. Targeting .NET 3.5 and lower works in the Preview 2 release SDK. All the relevant targeting packs are installed.
Expected behavior
A successful build
Actual behavior
Fails with the error:
... error MSB3644: The reference assemblies for framework ".NETFramework,Version=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. ...
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-preview3-004056)
Product Information: Version: 1.0.0-preview3-004056 Commit SHA-1 hash: ccc4968bc3
Runtime Environment: OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x64
Moved from https://github.com/dotnet/cli/issues/4626 for @Thealexbarney.
Moved from https://github.com/dotnet/sdk/issues/369 for @piotrpMSFT
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 28
- Comments: 35 (12 by maintainers)
Commits related to this issue
- Temporarily dropping support for .NETFramework 3.5. The current version of the dotnet CLI tooling contains a bug causing the build of this target to fail, breaking CI builds. See https://github.com/Mi... — committed to stevenvolckaert/enterprise-library by stevenvolckaert 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to dennisroche/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to shouldly/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add FrameworkPathOverride for net35 to workaround https://github.com/Microsoft/msbuild/issues/1333 — committed to josephwoodward/shouldly by deleted user 7 years ago
- Add support for .NET Standard (#308) * Update project files and solutions to support .NET Standard/Core - For class libraries, use a single .NET Core project which multi-targets net20, net35, net4... — committed to ZeBobo5/Vlc.DotNet by qmfrederik 7 years ago
- CI https://github.com/Microsoft/msbuild/issues/1333#issuecomment-296346352 — committed to RouR/MicroDocum by RouR 7 years ago
- Fix net35 build on command line Per Microsoft/msbuild#1333 — committed to mattjohnsonpint/TimeZoneConverter by mattjohnsonpint 6 years ago
- Fix build error https://github.com/Microsoft/msbuild/issues/1333#issuecomment-296346352 — committed to Y-YoL/UniCs2Cpp by Y-YoL 6 years ago
- Fix build error https://github.com/Microsoft/msbuild/issues/1333#issuecomment-296346352 — committed to Y-YoL/UniCs2Cpp by Y-YoL 6 years ago
- net35 does not play nicely with dotnet build from Core SDKs (see https://github.com/Microsoft/msbuild/issues/1333) - therefore removed net35 target (to be discussed if ok) — committed to icsharpcode/AvalonEdit by christophwille 5 years ago
- Fix https://github.com/Microsoft/msbuild/issues/1333 — committed to SeedTactics/orders by invalid-email-address 7 years ago
I got this working by adding the following to the
.csprojfile:Unfortunately, the “normal” path
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5doesn’t work in this case because it doesn’t have a copy ofmscorlib.dll.Update
This can now be addressed using the Microsoft.NETFramework.ReferenceAssemblies NuGet package. Click through to the “Project Website” for documentation.
Issues a pain when you’re trying to generate a multi-target nuget package; prior to the great cheese moving of 2016 I had no issues building a package that targeted 2/3.5/4/4.5/etc Is this likely to be sorted in the next few days when VS17s released? Seems ambitious…
Admittedly I’m
presumingthis is msbuild related as it came with RC4 / VS2017 changes and the issue in the error being thrown is the same as the op (albeit for every version specified).etc https://github.com/BcryptNet/bcrypt.net/blob/master/src/BCrypt.Net/BCrypt.Net.csproj
Hell, it might be that after all these changes and dotnet versions I need to set fire to my PC and start afresh to get things to build 🔥
Yeah, that doesn’t work for me, as there is no 3.5 version of
System.Webavailable anywhere in that folder structure. 😞What’s the work-around for people who need to build such projects on VS 2017? I just ran into this today, and the only thing I could figure out was to compile on a separate machine with only VS 2015 installed.
@JoshClose you can directly call
For version suffixes, add
/p:VersionSuffix=beta-123(however, note https://github.com/NuGet/Home/issues/4337)I see. I think that’s the answer to my question… 😄
(don’t use
dotnet build -f net35, usemsbuild /p:TargetFramework=net35)Should we we expect support from the CLI to .NET 3.5 eventually or is this just not planned?
The @NightOwl888 solution stopped working again.