-
Notifications
You must be signed in to change notification settings - Fork 25
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
Remove net471 as target framework. #9
base: master
Are you sure you want to change the base?
Remove net471 as target framework. #9
Conversation
This project only requires netstandard2.0 and can therefore skip the net471 as target framework. And the test project is more cross-platform friendly without net471 as target framework.
There might be some issues with this that I don't see. In that case, please be free to disregard. |
If I am not mistaken, dotnet will not include too many standard libraries when it is build/published along with another projects targeting .net framework. This was the primary reason why net471 was added. There could be another way of doing this though, however. If you know of a more elegant solution, please let me know. Also note that you are not required to build the project for every platform that the csproj specifies. If your intention is to only build the project and not really change anything, you can grab a build from the build server or use
to only build the target for netstandard 2.0. |
In an article on docs.microsoft.com there are some general guidelines for choosing target framework. And the main advice is to target netstandard2.0 if the library doesn't need any platform specific api's. Although it says something about issues with netstandard2.0:
In this github issue someone asks what kind of issues, but there's no more information about those issues provided. If that information is correct this library should target net461 I guess, but I still think netstandard2.0 is the best options for Rivers. I'm aware of |
Actually ➜ Rivers git:(feature/depth-info-on-traversal) ✗ dotnet build --framework netstandard2.0
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 46.56 ms for /Users/havarnov/dev/csharp/Rivers/Rivers/Rivers.csproj.
Restore completed in 49.86 ms for /Users/havarnov/dev/csharp/Rivers/Rivers.Test/Rivers.Test.csproj.
/usr/local/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1005: Assets file '/Users/havarnov/dev/csharp/Rivers/Rivers.Test/obj/project.assets.json' doesn't have a target for '.NETStandard,Version=v2.0'. Ensure that restore has run and that you have included 'netstandard2.0' in the TargetFrameworks for your project. [/Users/havarnov/dev/csharp/Rivers/Rivers.Test/Rivers.Test.csproj]
Rivers -> /Users/havarnov/dev/csharp/Rivers/Rivers/bin/Debug/netstandard2.0/Rivers.dll
Build FAILED.
/usr/local/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1005: Assets file '/Users/havarnov/dev/csharp/Rivers/Rivers.Test/obj/project.assets.json' doesn't have a target for '.NETStandard,Version=v2.0'. Ensure that restore has run and that you have included 'netstandard2.0' in the TargetFrameworks for your project. [/Users/havarnov/dev/csharp/Rivers/Rivers.Test/Rivers.Test.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.14 And neither does ➜ Rivers git:(feature/depth-info-on-traversal) ✗ dotnet build --framework netcoreapp2.2
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 30.14 ms for /Users/havarnov/dev/csharp/Rivers/Rivers/Rivers.csproj.
Restore completed in 29.42 ms for /Users/havarnov/dev/csharp/Rivers/Rivers.Test/Rivers.Test.csproj.
/usr/local/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1005: Assets file '/Users/havarnov/dev/csharp/Rivers/Rivers/obj/project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.2'. Ensure that restore has run and that you have included 'netcoreapp2.2' in the TargetFrameworks for your project. [/Users/havarnov/dev/csharp/Rivers/Rivers/Rivers.csproj]
Rivers -> /Users/havarnov/dev/csharp/Rivers/Rivers/bin/Debug/netstandard2.0/Rivers.dll
Rivers.Test -> /Users/havarnov/dev/csharp/Rivers/Rivers.Test/bin/Debug/netcoreapp2.2/Rivers.Test.dll
Build FAILED.
/usr/local/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1005: Assets file '/Users/havarnov/dev/csharp/Rivers/Rivers/obj/project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.2'. Ensure that restore has run and that you have included 'netcoreapp2.2' in the TargetFrameworks for your project. [/Users/havarnov/dev/csharp/Rivers/Rivers/Rivers.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.89 But the following works: dotnet build --framework netstandard2.0 Rivers/Rivers.csproj
dotnet test --framework netcoreapp2.2 Rivers.Test/Rivers.Test.csproj |
This project only requires netstandard2.0 and can therefore skip the
net471 as target framework.
And the test project is more cross-platform friendly without net471
as target framework.