commandline
commandline copied to clipboard
Building in .NET Framework 4
It's great that this library supports .NET Framework 4 – that's what makes it superior to System.CommandLine for our use case. However, we've only managed to use the pre-built DLL. When trying to build the project from master with our MSBuild version, it builds nothing and emits this warning:
warning MSB4078: The project file "src\CommandLine\CommandLine.csproj" is not supported by MSBuild and cannot be built.
Apparently the format of the .csproj file, with <Project sdk=...>
, is only supported from MSBuild version 15.0 onwards, while the .NET Framework 4 MSBuild version (4.8 in our case) only supports .csproj files with <Project ToolsVersion=...>
.
Has anyone had success building this library under .NET Framework version 4?
Why are you not just trying to create such an "old-style" project file by hand or in an old version of Visual Studio? There are no tricky bits in the sdk-style .csproj file as i can see. Just include the dependencies (there is just one needed if you were to build the F# version: FSharp.Core) as well as the defined build constants/symbols.
In case you don't have an older VS at hand, older versions of Visual Studio can still be found here: https://visualstudio.microsoft.com/vs/older-downloads/
Sorry, that's another aspect I didn't mention: I'm stuck in a very restrictive corporate environment where I essentially can't use external software, so no downloads like that. This also means no IDE and using the csc.exe compiler bundled with the .NET Framework version included in the Windows 10 install (which unfortunately is still 4.0). This is not a problem in and of itself, but it does make some open source projects more difficult to apply.
I'll probably just end up cobbling together a command line or compatible .csproj or something. The explicit support for my framework version had me thinking there might be an easier way, but then my use case is probably (hopefully!) too niche anyway.
It is a bit niche, but an old style csproj should work just fine. You could probably even dig up an old csproj version somewhere in the git history prior to the SDK change.