Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Framework targeting pack NuGet packages are missing net35 target framework #2022

Closed
AArnott opened this issue May 16, 2019 · 10 comments
Closed

Comments

@AArnott
Copy link

AArnott commented May 16, 2019

net35 is a legit target framework for .NET projects, but projects that target that framework can't build off Windows even when referencing the Microsoft.NETFramework.ReferenceAssemblies package.

@dsplaisted
Copy link
Member

What happens when you try to build? What's the error message?

@AArnott
Copy link
Author

AArnott commented May 16, 2019

/usr/share/dotnet/sdk/2.1.300/Microsoft.Common.CurrentVersion.targets(1179,5): 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. 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. [/home/andrew/git/pinvoke/src/Windows.Core/Windows.Core.csproj]

@AArnott
Copy link
Author

AArnott commented May 16, 2019

BTW in case anyone was curious why I would want to target net35, it was done here so the compiler could use ExtensionAttribute.

@0xd4d
Copy link

0xd4d commented Jun 4, 2019

There's a net20 nuget package so IMHO net30 and net35 should also be supported.

https://www.nuget.org/packages/Microsoft.NETFramework.ReferenceAssemblies.net20

@0xd4d
Copy link

0xd4d commented Jun 18, 2019

Similar issue dotnet/msbuild#1333

@dsplaisted
Copy link
Member

Unfortunately we've decided not to do this

@jnm2
Copy link

jnm2 commented Nov 20, 2019

@dsplaisted Is it because of the C++/CLI System.Data dll? The net35 pack is the one that matters for those targeting .NET Framework versions that are currently supported. Can a community member fill the gap?

@jnm2
Copy link

jnm2 commented Nov 25, 2019

Because net35 is still in support and net40 and net20 are not, and the Microsoft.NETFramework targeting pack includes net20 and net40 but not net35, and because I'm familiar with the pain of not having the choice to stop supporting net35, I created a community package to go along with these:

https://www.nuget.org/packages/jnm2.ReferenceAssemblies.net35

There doesn't seem to be any technical limitation distinguishing this package from the Microsoft packages, and my integration tests show this working fine:

Example.csproj
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net35;net40;netstandard2.0;netcoreapp3.0</TargetFrameworks>
  </PropertyGroup>
  
  <ItemGroup>
    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
    <PackageReference Include="jnm2.ReferenceAssemblies.net35" Version="1.0.0" />
  </ItemGroup>

</Project>
ClassUsingSystemLinq.cs
using System.Linq;

public class ClassUsingSystemLinq
{
    public ClassUsingSystemLinq()
    {
        Enumerable.Empty<int>();
    }
}

This solves the problem of having to use VSWhere to find MSBuild when compiling for net35 on Windows and the problem of having to use Mono's MSBuild when compiling for net35 on macOS and Linux. dotnet build all the way. Here's to less infrastructure fighting. Happy coding!

@stevenvolckaert
Copy link

@jnm2 Thanks so much for sharing!!

@jnm2
Copy link

jnm2 commented Dec 5, 2019

ℹ 1.0.0 of https://www.nuget.org/packages/jnm2.ReferenceAssemblies.net35 is up, mirroring the changes made in Microsoft.NETFramework.ReferenceAssemblies 1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants