Monogame: NET 5 support for tools

Created on 11 Nov 2020  路  9Comments  路  Source: MonoGame/MonoGame

NET 5 is now available

I've created monogame project based on .net core, updating project file to:

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net5.0-windows</TargetFramework> <PublishReadyToRun>false</PublishReadyToRun> <TieredCompilation>false</TieredCompilation> <UseWindowsForms>true</UseWindowsForms> </PropertyGroup>

gives the following error:
Severity Code Description Project File Line Suppression State Error MSB3073 The command "dotnet C:\Users\Root\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\\..\tools\netcoreapp3.1\any\mgcb.dll /quiet /@:"C:\Users\Root\source\repos\Game1\Game1\Content\Content.mgcb" /platform:Windows /outputDir:"C:/Users/Root/source/repos/Game1/Game1/Content/bin/Windows/Content" /intermediateDir:"C:/Users/Root/source/repos/Game1/Game1/Content/obj/Windows/Content" /workingDir:"C:/Users/Root/source/repos/Game1/Game1/Content/"" exited with code -532462766. Game1 C:\Users\Root\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\MonoGame.Content.Builder.Task.targets 138

What version of MonoGame does the bug occur on:

  • MonoGame.Framework.WindowsDX 3.8.0.1641
  • MonoGame.Content.Builder.Task 3.8.0.1641

What operating system are you using:

  • Windows 10 x64 10.0.19042.572

What MonoGame platform are you using:

  • DesktopGL
Maintenance

Most helpful comment

.NET 5 support is planned, we're looking into it (though some targets, like Android and iOS, are not going to make the jump until .NET 6 because Xamarin hasn't switched to it yet).

All 9 comments

Does it work if you downgrade to dotnet core 3.1? This does not seem related to dotnet 5. It looks more like some issues with calling the content builder from nuget. Have you restored nuget packages? Can you post your full csproj?

Yes, when i downgrade the project runs.
You can create the basic monogame dx project and just replace string in targetframework.

This is what I did:
run "dotnet new --install MonoGame.Templates.CSharp"
run "dotnet new mgwindowsdx"
edit project file to have target framework "net5.0-windows" and change Sdk="Microsoft.NET.Sdk"
run "dotnet run"
it builds and launches my game with out error or warnings.

Here is my csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows</TargetFramework>
    <PublishReadyToRun>false</PublishReadyToRun>
    <TieredCompilation>false</TieredCompilation>
    <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <ApplicationIcon>Icon.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <TrimmerRootAssembly Include="Microsoft.Xna.Framework.Content.ContentTypeReader" Visible="false" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="MonoGame.Framework.WindowsDX" Version="3.8.0.1641" />
    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" />
  </ItemGroup>
  <ItemGroup>
    <MonoGameContentReference Include="Content\Content.mgcb" />
  </ItemGroup>
</Project>

You need to have the .NET Core 3.1 runtime installed to run the tools. We should multitarget them so they support .NET 5 as well.

I've 3.1. I'm using Monogame extension.

Update: i've managed to compile the new (empty) project. Trying to find the cause with my original project.

vanilla monogame project works for me on .net 5.0 (on Mac)
The one which uses MonoGame.Content.Builder.Task does not.
So I guess it is indeed the tooling support which needs to catch up.

.NET 5 support is planned, we're looking into it (though some targets, like Android and iOS, are not going to make the jump until .NET 6 because Xamarin hasn't switched to it yet).

To temporarily solve this problem, you can go to https://dotnet.microsoft.com/download/dotnet-core/3.1
Download .NET Core Runtime 3.1

Just upgraded my project to .net5 and had no issues.

Was this page helpful?
0 / 5 - 0 ratings