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

enable support for .NET Fx 4.6.1 <-> .NET Standard 2 #3447

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

0x53A
Copy link
Contributor

@0x53A 0x53A commented Dec 5, 2018

This should be finished, but I need to do some manual tests.

Let's run CI.


What

This allows users to opt-in to support between .NET Fx 4.6.1 and .NET Standard 2.0.

How

You can set EnableNetFx461NetStandard2Support in the app.config of paket.exe (works both for "normal" paket.exe and magic-mode paket.exe).

If you use Paket.Core as a Library, you can set

DotnetToolingSupport.mode <- ToolingSupportMode.ToolingSupportNetSDK2

Caveats

This is a hacky workaround for a shoddy implementation by Microsoft in the .NET SDK 2.x.

After setting this flag, delete and regenerate your lockfile. Just running install is not enough.

Ensure that the flag is consistently either always on, or always off. Check paket.exe.config into source control.


supersedes #3248

fixes #3004 (it would then add the .NET Standard 2 dll for .NET 4.6.2)

fixes #2986
fixes #2705

ref #2391

and see https://twitter.com/terrajobst/status/1032025428242849793

@0x53A
Copy link
Contributor Author

0x53A commented Dec 6, 2018

grafik

that error looks unrelated

@0x53A 0x53A closed this Dec 6, 2018
@0x53A 0x53A reopened this Dec 6, 2018
@forki
Copy link
Member

forki commented Apr 2, 2019

can you please merge with master?

@forki
Copy link
Member

forki commented Apr 2, 2019

woud be good to have the setting as a group setting

@0x53A
Copy link
Contributor Author

0x53A commented Apr 30, 2019

Hi @forki, sorry for the delay, I've merged latest master and let's see what CI says.

would be good to have the setting as a group setting

when I started with this, i took a look at how a proper implementation could be done, and it was a lot of work, touching almost everything.

You would need to parametrize FrameworkIdentifier.RawSupportedPlatforms by this flag, and pass it everywhere.


After CI is green I'll do another manual test, I think it worked ... almost half a year ago, but just to be sure ...

(And maybe add a test or two)

@0x53A
Copy link
Contributor Author

0x53A commented May 3, 2019

I wanted to add an end2end integration test, but hit an unexpected issue:
With PR #2664 I made it so that the build doesn't use the local reference assemblies for compilation, but instead from a NuGet package (0x53A.ReferenceAssemblies.Paket).

Currently this package only contains the ref-assemblies for net45, so I can't create a test project with .net461.

Adding the ref-assemblies for net461 into this package would double the package size (from 100MB extracted to 200MB extracted), which i don't think is worth it.

So instead I've create a small unit test which doesn't check compilation, but just resolving.

@0x53A
Copy link
Contributor Author

0x53A commented May 3, 2019

Manual tests for both direct execution and bootstrapper exection were Ok. If you use the bootstrapper, then you also need the latest paket.exe downloaded, an old one from cache obviously doesn't understand the new flag.

@0x53A 0x53A changed the title [WIP] enable support for .NET Fx 4.6.1 <-> .NET Standard 2 enable support for .NET Fx 4.6.1 <-> .NET Standard 2 May 3, 2019
@0x53A
Copy link
Contributor Author

0x53A commented May 27, 2019

merged master, now build is green again

@marcinsmialek
Copy link

What's the status of this PR?

I know we have .NET Framework 4.8 now, but some people refuse to install anything newer than 4.6.1 😒

@forki
Copy link
Member

forki commented Sep 16, 2019

We can't take it as it. We need a group setting for it since it's breaking and even MS admitted it is not correct.

@0x53A
Copy link
Contributor Author

0x53A commented Sep 16, 2019

It's not directly breaking, since you would have to enable it in the app.config manually. So if you do nothing, nothing changes.

Can you maybe take a quick look at an implementation strategy?

If you want to make it a group setting, then the hack with the global mutable field isn't enough, you would have to parametrize SupportCalculation.getSupportedPlatforms etc by this flag. It would need to be passed down, and this would touch almost everything.

At least that was my conclusion a year ago, and the reason why I settled on the app.config "hack".

@forki
Copy link
Member

forki commented Sep 20, 2019

would it work with paket global tool or magic mode?
I feel this should at least be a setting in the deps file

| DotNetFramework FrameworkVersion.V4_6_1 ->
match DotnetToolingSupport.mode with
| ToolingSupportMode.NativeSupport -> [ DotNetFramework FrameworkVersion.V4_6; DotNetStandard DotNetStandardVersion.V1_4 ]
// .NET Standard 2.0 will propagate "down", so we don't need any switches on the subsequent frameworks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just note that depending on this will subtly prefer netstandard1.5 in some situations over netstandard2.0 (for example in net462).
The possible impact of this is smaller as expected as we forward all packages to nuget in the final step, but the list of packages might differ.

@0x53A
Copy link
Contributor Author

0x53A commented Sep 20, 2019

would it work with paket global tool or magic mode?

It should already work as is with magic mode, just set the app.config of the bootstrapper.

I feel this should at least be a setting in the deps file

I guess that would be possible to make work - read the setting, then set the global variable before doing any other operations.

It would be treated similar to the "version" global setting.

@forki
Copy link
Member

forki commented Sep 20, 2019 via email

@xperiandri
Copy link

@0x53A, where to put

You can set EnableNetFx461NetStandard2Support in the app.config of paket.exe (works both for "normal" paket.exe and magic-mode paket.exe).

What is the structure of app.config? I can't find such a setting anywhere

@0x53A
Copy link
Contributor Author

0x53A commented Jan 7, 2021

As this PR wasn't merged, there is no such feature.

It wasn't merged because the app settings is more of a hack, and it would have been preferable to add a setting to the paket.dependencies.

Though at that point I didn't have any more time / energy.

Theoretically it would have been in the appSettings:

    <?xml version="1.0" encoding="utf-8" ?>  
    <configuration>  
      <appSettings>  
        <add key="EnableNetFx461NetStandard2Support" value="true"/>  
      </appSettings>  
    </configuration>  

@RagingKore
Copy link

any news on this?

@xperiandri
Copy link

@0x53A do we need this or should it be updated?

@marcinsmialek
Copy link

marcinsmialek commented Sep 23, 2023

Due to the end-of-life of .NET 4.6.1, it was necessary to update the .NET Framework version, where possible.
Most of the migrations I've seen were to .NET 4.7.2 and 4.8.0, which support .NET Standard 2 well. I assume that such upgrades are prevalent, which would diminish the significance of this change. However, I have also encountered 4.6.1 -> 4.6.2 transitions too.

The 4.8.1 version looks good, but it's not supported on Windows Server 2019, and we can treat it as 4.8.0.

If you choose to implement a flag that allows Paket to treat 4.6.1/4.6.2 as .NET Standard 2 compatible, I think that it should also be easy to remove to simplify the codebase when the impact will decrease over time.
Perhaps the version match could be delegated and possible to override by an extension?

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