Search code examples
c#visual-studiomonogame

Error MSB3073 when creating a Monogame C# project in Visual Studio 2019


So I'm trying to simply create a new Monogame project in Visual Studio 2019 with C#, and every time I create a new project, the following error appears:

Error MSB3073 - The command "dotnet C:\Users\<name>\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\\..\tools\netcoreapp3.1\any\mgcb.dll /quiet /@:"E:\Programming\Locally-stored projects\C Family\C#\Monogame -OxygOS\Game1\Game1\Content\Content.mgcb" /platform:DesktopGL /outputDir:"E:/Programming/Locally-stored projects/C Family/C#/Monogame - OxygOS/Game1/Game1/Content/bin/DesktopGL/Content" /intermediateDir:"E:/Programming/Locally-stored projects/C Family/C#/Monogame - OxygOS/Game1/Game1/Content/obj/DesktopGL/Content" /workingDir:"E:/Programming/Locally-stored projects/C Family/C#/Monogame - OxygOS/Game1/Game1/Content/"" exited with code 1. Game1   C:\Users\<name>\.nuget\packages\monogame.content.builder.task\3.8.0.1641\build\MonoGame.Content.Builder.Task.targets    138 

The only files in the projects are ones that are automatically created as part of the Monogame Cross-platform template.

I've already looked on Google and Stack Overflow, and, while there are answers, I haven't found any that have helped me.

Apologies if I messed up while creating the post, this is my first Stack Overflow question :D I may have messed up the formatting somewhere so sorry in advance if I have.


Solution

  • It is a better approach that you would use the terminal to create your project (and then open them in Visual Studio). It is far more convenient for the Monogame community to release NuGet templates of the projects rather than releasing plugins for Visual Studio, and therefore it is safe to assume that Monogame won't be releasing such plugins for Visual Studio anytime soon.

    Make sure you have dotnet-sdk installed and the Monogame tools are installed by doing all the steps mentioned here, Including the last two scripts

    dotnet tool install --global dotnet-mgcb-editor
    mgcb-editor --register
    

    and

    dotnet new --install MonoGame.Templates.CSharp
    

    Now use the command dotnet new to view all the templates. You will probably see an output such as

    
    Templates                                                   Short Name               Language          Tags
    ------------------------------------------------------      -------------------      ------------      ----------------------
    ...
    ...
    MonoGame Android Application                                mgandroid                [C#]              MonoGame
    MonoGame Cross-Platform Desktop Application (OpenGL)        mgdesktopgl              [C#]              MonoGame
    MonoGame iPhone/iPad Application                            mgios                    [C#]              MonoGame
    MonoGame Windows Universal Application (CoreApp)            mguwpcore                [C#]              MonoGame
    MonoGame Windows Universal Application (XAML)               mguwpxaml                [C#]              MonoGame
    MonoGame Windows Desktop Application (Windows DirectX)      mgwindowsdx              [C#]              MonoGame
    MonoGame NetStandard Library                                mgnetstandard            [C#]              MonoGame
    MonoGame Pipeline Extension                                 mgpipeline               [C#]              MonoGame
    MonoGame Shared Library Project                             mgshared                 [C#]              MonoGame
    ...
    ...
    

    Select the project you want to create, for example

    dotnet new mgwindowsdx -o MyGame
    

    This will create a folder "MyGame" and put the code for your game. You can open the .csproj file using Visual Studio.