Yesterday my project was compiling normally, today I updated Visual Studio and now I’m getting a compile error for the Content Builder.
The command “dotnet “” /quiet /@:“M:\Documents\Projects\Farm\Farm\Content\Content.mgcb” /platform:DesktopGL /outputDir:“M:/Documents/Projects/Farm/Farm/Content/bin/DesktopGL/Content” /intermediateDir:“M:/Documents/Projects/Farm/Farm/Content/obj/DesktopGL/net7.0/Content” /workingDir:“M:/Documents/Projects/Farm/Farm/Content/”” exited with code 1.
Here is the offending line
<!-- Execute MGCB from the project directory so we use the correct manifest. -->
Condition="'%(ContentReference.FullPath)' != ''"
-> Command="$(DotnetCommand) "$(MGCBPath)" $(MonoGameMGCBAdditionalArguments) /@:"%(ContentReference.FullPath)" /platform:$(MonoGamePlatform) /outputDir:"%(ContentReference.ContentOutputDir)" /intermediateDir:"%(ContentReference.ContentIntermediateOutputDir)" /workingDir:"%(ContentReference.FullDir)""
Condition="'%(ContentReference.ContentOutputDir)' != ''"
It’s listing all the output directories of the Content.mgcb file and I’ve confirmed that they do indeed exist. I’ve tried rebuilding the Content and then rebuilding the project, no luck. I’ve checked for updates for Monogame and I’m up to date (version 126.96.36.1993 for Content.Builder.Task).
A prior fix for this issue I found from several years ago does not work because my Content.Builder.Task.targets already has quotes around the $(MGCBPath) (and I believe it was fixed in the master).
Anybody know what could be going on here?
“dotnet “” /quiet /
Looks like its missing the
$(MGCBPath) value. I’d check furter up the log and see why that property is not being set.
I created a blank new project and am getting the same error.
When I look at the output log I’m not seeing anything that looks particularly helpful
1>------ Build started: Project: Project1, Configuration: Debug Any CPU ------
1>Tool 'dotnet-mgcb' (version '188.8.131.523') was restored. Available commands: mgcb
1>Tool 'dotnet-mgcb-editor' (version '184.108.40.2063') was restored. Available commands: mgcb-editor
1>Tool 'dotnet-mgcb-editor-linux' (version '220.127.116.113') was restored. Available commands: mgcb-editor-linux
1>Tool 'dotnet-mgcb-editor-windows' (version '18.104.22.1683') was restored. Available commands: mgcb-editor-windows
1>Tool 'dotnet-mgcb-editor-mac' (version '22.214.171.1243') was restored. Available commands: mgcb-editor-mac
1>Restore was successful.
1>Unrecognized command or argument '/quiet'.
1>Unrecognized command or argument '/@:M:\Documents\Project1\Project1\Content\Content.mgcb'.
1>Unrecognized command or argument '/platform:DesktopGL'.
1>Unrecognized command or argument '/outputDir:M:/Documents/Project1/Project1/Content/bin/DesktopGL/Content'.
1>Unrecognized command or argument '/intermediateDir:M:/Documents/Project1/Project1/Content/obj/DesktopGL/net6.0/Content'.
1>Unrecognized command or argument '/workingDir:M:/Documents/Project1/Project1/Content/'.
Do you know how I can check where the
$(MGCBPath) value isn’t being set?
While I did not fix the error, I did find a solution. I believe when Visual Studio updated it might have changed/reset some paths, as when I went to create a new project the default projects folder was changed. I believe this might have reset the MGCBPath somehow and this is unfortunately something I do not know how to correct. I cleared my Nuget cache and reloaded all the Monogame dependencies which resolved the error on the new project I created while debugging, but the error persisted for the old main project. I opted to simply create a new project and migrate all my classes and content over. This effectively resolved the issue, though I cannot comment on the underlying problem.