Skip to content

Allow pure .NET 5 builds #51

@neeraj9

Description

@neeraj9

I am a bit new to this so not sure if this is entirely accurate. Irrespective it appears that FrozenObjects should target multiple .net releases for if anyone trying to use it has just .NET 5 SDK installed.
I have tried to incorporate the changes within the branch [3] and first commit [4] but the build fails. Trying to duplicate the same information as in commit [4] here for completeness.

---- snip from comment within [4] ----
The build does fail on my system which has just .NET 5 SDK
(5.0.101). The brief errors is as follows. It is strange
that the build is not looking for System.Private.CoreLib.dll
under
"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.1\System.Private.CoreLib.dll"
which exists.

dotnet build -f net5.0 -v detailed .\Microsoft.FrozenObjects.sln
Dependency "System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e".
	Could not resolve this reference. Could not locate the assembly "System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
	     For SearchPath "D:\other\FrozenObjects\src\obj\Debug\net5.0".
	     Considered "D:\other\FrozenObjects\src\obj\Debug\net5.0\System.Private.CoreLib.winmd", but it didn't exist.
	     Considered "D:\other\FrozenObjects\src\obj\Debug\net5.0\System.Private.CoreLib.dll", but it didn't exist.
	     Considered "D:\other\FrozenObjects\src\obj\Debug\net5.0\System.Private.CoreLib.exe", but it didn't exist.
	 Required by "Microsoft.FrozenObjects.InternalCalls".
  1. dotPeek tells me that the PublicKeyToken used within
    System.Private.CoreLib is same within netcoreapp3.1 and
    net5.0.
Assembly System.Private.CoreLib, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e

Assembly System.Private.CoreLib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e
  1. I have tried to follow [1] while targetting multiple frameworks,
    but could be missing something (considering build fails).

  2. As per [2] the preprocessor for net5 is NET5_0.

[1]
https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks
[2]
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-if#remarks
[3] https://github.com/neeraj9/FrozenObjects/tree/dev-net5.0
[4] neeraj9@960dbae

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions