or-tools: Missing support for .NET Framework in latest Nuget packages
What language and solver does this apply to? C#
Describe the problem you are trying to solve.
Use Google.OrTools
Nuget package, versions 9.3 and later, in a .NET Framework 4.8 project.
Describe the solution you’d like Being able to use the latest Nuget pacakge in .NET Framework.
Describe alternatives you’ve considered
Additional context With version 9.2 and earlier, .NET Framework was supported. Why was .NET Framework support dropped?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 28 (3 by maintainers)
@Mizux , maybe a single NetStandard 2.0 ?
.NET Framework: 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 ref: https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0
@lperron The code changes I have made in PR #3542 are not in any way related to code optimization. I have only reverted the use of some C# 9 syntactic sugar. Code functions exactly the same as before, it is just a change of expressing the patterns in code.
The changes I have made have no negative impact on the ability to build on VS 2019, quite the opposite, since I would expect that C# 8 is more reliably supported on VS 2019 than is C# 9.
And yes, although not officially supported it looks like the current code builds for .NET Framework 4.6.1 and forward with language version set to 9. As a .NET Framework user I would still be concerned that the code could misbehave in scenarios not captured in compilation, but at this point I have yet no indication that it will not work.
FYI.
When manually building the Google.OrTools.csproj project for .NET Framework, I noticed that C# language version was set to 9.0 in the project file. Officially, .NET Framework is only expected to support C# up to language version 8, but I got no compilation errors when building, at least for .NET Framework 4.8.
When changing language version to 8.0 in the project file, I get the following compilation errors:
@Mizux @lperron Many thanks for reopening this request!
Regarding the version of .NET Framework, I would recommend that you target .NET 4.6.1 or 4.6.2. That would definitely be enough for most .NET Framework users, and it is forward compatible up to .NET Framework 4.8.
I understand your concern on the
<TargetFrameworks>
issue, although I believe you have some kind of solution for it? Anyway, targeting .NET Framework 4.6.1 (2), .NET Core 3.1 and .NET 6 will probably suffice for quite a while forward.Regarding .NET Standard 2.0, that would of course be a tempting solution, but I am not sure about accessing the native x64 libraries directly from a .NET Standard assembly? It will probably be less extra work if you stick with the approach you have chosen now for .NET.
Hi guys, I’m developing a visual studio extension based on or-tools. As VS runs on .NET framework, it would be great if the newest version of or-tools could support net472. Thanks!