Closed ricaun closed 4 months ago
What exactly is the benefit compared to the auto-loaded .props
file?
The .props
is goes only to the main csproj
that referencing the Nuke.Commum
.
This mean if I create a package with the dependencies Nuke.Commum
or Nuke.Tooling
, the .props
does not progate to the main csproj
that use the package.
Here is my package the uses that. https://www.nuget.org/packages/ricaun.Nuke#dependencies-body-tab
Now I could add the .props
in my ricaun.Nuke
package, or try to fix in the Nuke.Tooling
to force enable the switch on runtime fixing the issue with net8.0.
The benefits would be using the Nuke.Tooling
without any extra confuguratuon in the csproj
or .props
.
This looks like the proper solution (especially for projects which using/extending Nuke.*)
At the moment I gonna use this in my package.
By default when the DLL is load the module switch the EnableUnsafeBinaryFormatterSerialization
to true.
Sorry for necro posting, but setting https://github.com/nuke-build/nuke/blob/abeb8afc9ec80abf1c92e14549b3b8b2d00bae8f/source/Nuke.Tooling/SettingsEntity.NewInstance.cs#L21 Is not enough, at least for the net9 SDK as the code for binary formatter is missing there. You also need to include the package
<ItemGroup>
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="9.0.0" />
</ItemGroup>
@ScarletKuro adding System.Runtime.Serialization.Formatters
in .NET 9 make binary formatter to work?
@ScarletKuro adding
System.Runtime.Serialization.Formatters
in .NET 9 make binary formatter to work?
Yes.
MSFT talked about the removal of BinaryFormatter from .NET 9 a long time ago and providing compatibility package.
Hello everyone,
This PR forces to
EnableUnsafeBinaryFormatterSerialization
in runtime instead of adding the configuration in the csproj.This is done by using the code below before using the
BinaryFormatter
. (Reference: https://github.com/pythonnet/pythonnet/issues/2282)I add a simple test in the Nuke.Tooling.Tests and changes to NET 8.0 to make sure the
BinaryFormatter
gonna work without anyEnableUnsafeBinaryFormatterSerialization
in the csproj.This gonna make sure the
BinaryFormatter
gonna works regardless if has or hasn't the configuration in the csproj.And just to remind that the
BinaryFormatter
gonna be removed in the next .NET Core (.NET 9.0 - https://github.com/dotnet/announcements/issues/293)I confirm that the pull-request: