C
C#3mo ago
dmr

MSB4019 error when building Windows game binary on Linux

I'm learning C# and MonoGame, and I wanted to verify that I could successfully build a redistributable windows binary of my WIP game, so I decided to first confirm I could do it with one of the MonoGame sample projects, in this case AutoPong (see https://github.com/MonoGame/MonoGame.Samples). Attempting to build, I get the following
/usr/share/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1355,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets" was not found. Confirm that the expression in the Import declaration ";/usr/share/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk/targets/../../Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets" is correct, and that the file exists on disk
/usr/share/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1355,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets" was not found. Confirm that the expression in the Import declaration ";/usr/share/dotnet/sdk/8.0.108/Sdks/Microsoft.NET.Sdk/targets/../../Microsoft.NET.Sdk.WindowsDesktop/targets/Microsoft.NET.Sdk.WindowsDesktop.targets" is correct, and that the file exists on disk
I have no idea whether the import declaration is correct, although it seems reasonable, but the file definitely does not exist on disk. This makes me think there's something I'm supposed to have installed in order to be able to build a Windows desktop binary. Maybe a nuget package that enables the target? Unfortunatly I'm not very familiar with the dotnet build system, and it's really hard to search for info on this (I keep getting "how to build for linux on windows"). So I hope somebody can help me, because I bet this is really easy if you're less ignorant of dotnet than I am.
4 Replies
reflectronic
reflectronic3mo ago
are you trying to build the WindowsDX solution? that won't work
dmr
dmrOP3mo ago
I am why not?
reflectronic
reflectronic3mo ago
the WindowsDX project is targeting net8.0-windows. it means that the project pulls in Windows-specific APIs and libraries and build logic (in this case, it looks like WindowsDX uses Windows Forms). these Windows-specific libraries cannot all be built from public source (there are some proprietary libraries among them), and it is generally a hard rule for maintainers of distro packages that there can't be proprietary blobs inside of packages, so the WindowsDesktop assets needed to support net8.0-windows are generally excluded when distro maintainers build their .NET packages if you install the Microsoft-built version of .NET then these assets are available and the build would succeed generally you can distribute the DesktopGL version on Windows just fine. i don't know if there is a substantial performance difference between them
dmr
dmrOP3mo ago
^ this is correct & worked
Want results from more Discord servers?
Add your server