fsprojects / FAKE

FAKE - F# Make
https://fake.build
Other
1.28k stars 582 forks source link

Update assembly-resolver to not hardcode .NET 6.0 #2777

Open Thorium opened 1 month ago

Thorium commented 1 month ago

Description

Some workarounds to issue [mentioned in https://github.com/fsprojects/FAKE/issues/2713]:(https://github.com/fsprojects/FAKE/issues/2713#issuecomment-1312560991) The .NET version was for no reason hard-coded to 6.0 and not coming from an environment variable that can be overwritten by the user. There is no reason why Fake needs to be updated every time .NET version updates.

  1. This commit adds new FAKE_SDK_RESOLVER_CUSTOM_DOTNET_VERSION which can be used to change the default "6.0" to whatever other version. So you set it to .NET "18.5" if you want.

  2. Also, this changes assembly-resolver to use lists instead of single strings: SdkVersionRaws SdkVersions and PaketFrameworkIdentifiers. The default is still list of single item ["6.0"] to not break any backward-compatibility. However, in many cases the user has multiple NET versions installed in the computer and is just interested of whatever defined in wherever "globals.json" and not what Fake is compiled with. Currently the system just throws build errors, meanwhile user would just want to old VB style on-error-resume-next: "come on, build it now!", e.g. user tries to builds .NET 8 software. So you can define "6.0" and "8.0" and then the assembly-resolver will check what it can find. There are still backward compatible versions kept, SdkVersionRaw SdkVersion and PaketFrameworkIdentifier which just take the first from the list.