MG 3.7.1 on Win10 VS2015/2017: MGCB too many arguments

Monogame 3.7.1 on Win10 VisualStudio 2015 Community and 2017 Community: when compile Monogame Windows 8.1 Universal project (VS2015) or Monogame Windows 10 Universal project (VS2017) I get -532462766 error. When tried to launch MGCB in command line I get “too many arguments” error:

Unhandled exception: System.IO.IOException:

System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
MGCB.MGBuildParser.ShowError(String message, Object[] args)
MGCB.MGBuildParser.ParseArgument(String arg)
MGCB.MGBuildParser.ParseFlags(String arg)
MGCB.MGBuildParser.Parse(IEnumerable`1 args)
MGCB.Program.Main(String[] args)

error MSB3073: The command ““C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe” /quiet /platform:WindowsStoreApp /@:“E:\Dev\w10\myapp1\Content\Content\Content.mgcb” /outputDir:“bin\WindowsStoreApp\Content” /intermediateDir:“obj\WindowsStoreApp\Content”” exited with code -532462766.

Even when I edited a MonoGame.Content.Builder.targets to minimize MGCB arguments I get the same error.

I tried to recreate project, reinstall Monogame 3.5, 3.6, 3.7.1 (I fully removed previous versions and templates), tried to launch mgcb in command line, yet nothing helped. Even only one parameter is too many. I suspect there is something wrong with command interpreter or W10, but I don’t know what. I also tried to remove all global arguments from response file (Content.mgcb) but no luck.

The strangest thing is that yesterday on freshly installed VS2015 monogame content build worked, processed all my assets but at the end of build threw an exception “File /.mgcontent not found” so that VS build failed, thus I unistalled MG and installed again, and then “too many arguments” error appeared and still exists.

Do anyone has Monogame installed and MGCB working on Win10 with VS2015-2017? How to make it work?

that errorcode number looks wierd … and it’s also strange, that the exception is thrown in “ShowError” / “GetBufferInfo”

looks to me that something’s blocking the console or something …

Win10 / VS2017 here and no such problems

Even if I launch MGCB directly in console it says “too many arguments”.
But before I unistalled and installed again 3.7.1 it worked (only threw error in the end, but all assets were processed). I’d like to return to this behaviour at least.

It looks like I have to debug MGCB myself. Stupid thing, I also did it years ago, when it couldn’t process jpgs, and hoped I will not do that again. I don’t know about you but in my case monogame every time is half-dead thing which works only from time to time, just like xamarin

How much space have you got on E:?

Are you using any third party security apps?

Are you admin?

Many of us use MonoGame without issue from the get go, does this occur with a fresh template?

From what I have read, you are compiling a custom setup, you should expect odd behaviour in such situations…

‘sigh’ Welcome to the forums…

  1. 27Gb on E:
  2. No, only w10 standard tools.
  3. Yes, account is admin.
  4. Yes, I created new Win8.1 universal monogame project in VS2015 and w10 universal in VS2017.
  5. Thank you!

I’ve started to play with Content.mgcb and finally have found that error “too many arguments” was caused by several commented with ‘#’ strings at the end of it (I may not clearly understand file format).
Ok, I removed “commented” lines but after all assets are processed it throws:
System.IO.DirectoryNotFoundException: “E:\Dev\w10\myapp1\Content\Content\obj\WindowsStoreApp\Content.mgcontent”.
1> System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1> System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1> System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1> System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
1> System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
1> System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding)
1> MGCB.SourceFileCollection.Write(String filePath)
1> MGCB.BuildContent.Build(Int32& successCount, Int32& errorCount)
1> MGCB.Program.Main(String[] args)

Even without VS, running mgcb in command line I get the same error after all assets are successfully processed.
What is the .mgcontent file? In E:\Dev\w10\myapp1\Content\Content\obj even there is no WindowsStoreApp folder, it exists higher :\Dev\w10\myapp1\Content\obj\WindowsStoreApp\Content, but it’s empty.

Visual Studio is actually just calling mcgb on the command line - the .targets file just builds the command string

the .mgcontent file is an intermediate file - that’s why it’s in the obj folder. If something is not working during building, that file will not exist.

not sure, why you’re editing the .targets file … it’s xml and comments in xml are like

<!-- ... -->

(as seen on the top of the .targets file)

the path which seems to be wrong and it’s contrcuted in a Mono Builder DLL so it’s more likely, that something’s misconfigured (maybe the templates are, haven’t tried the universal ones yet)

what path is your content.mcgb file?

I’ve fixed my problem with “too many arguments”, now after I installed Monogame 3.7.1 I’m trying to create new Win8.1 Monogame project.
As always monogame installer installed useless trash (I had to build 3.5 myself to make it work), none of project templates work except Windows classic (for Win/Winphone there even no dlls in C:\Program Files (x86)\MonoGame\v3.0\Assemblies).
Ok it doesn’t matter, I need a project only to build my assets, so I set things up, and then again:

System.IO.DirectoryNotFoundException: “E:\Dev\w10\myapp1\Content\Content\obj\WindowsStoreApp\Content.mgcontent”.
1> System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1> System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1> System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1> System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
1> System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
1> System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding)
1> MGCB.SourceFileCollection.Write(String filePath)
1> MGCB.BuildContent.Build(Int32& successCount, Int32& errorCount)
1> MGCB.Program.Main(String[] args)

And again ended up with rollback to previous version of Monogame, in my case 3.5. Conclusion: mgcb from 3.7.1 installer is defective. Dear devs, it’s a shame that newer versions work worse that old ones, it’s just like Microsoft does things. Heck, I’ve spent two days just because I installed latest version instead of just using good old self compiled 3.5. Arghh!

See this PR. Windows 8.1 support has been removed from MonoGame with the 3.7 release. If you still wish to build for that platform (you need to have a very good reason at this point, to be honest), you have to remain on an older version.

By “very good reason” you mean 40% of customers? :slight_smile:

Where are you getting this number from? OS market share indicates that Windows 10 has vastly more users with Windows 8.1 declining. Many engines and libraries (including SharpDX and MonoGame) no longer support it, and mainstream support for the OS ended sometime last year. Am I missing something?

Obviously number from my client base. I have to update my old apps to keep users happy. The same situation was with WP7 years ago. You won’t believe, but on Android I keep minimum version API17 (for some apps 14), and on iOS - 7.0 (at least on code level). Of course I could do business just like Microsoft and tell users “f*ck off”. But why?

2 Likes

My apologies; I incorrectly assumed you were starting up a brand new game. Regarding your MGCB issue: I’ve started exclusively building from source since 3.6, and my MGCB for 3.7+ works fine. Have you tried building the MGCB from develop from source and using that in your 3.5 project?

While Windows 8.1 store apps as a target are deprecated by MG, regular Windows DirectX Projects will run on Windows 8, even as far back as Windows XP if you build for
.NET 4.0.

I know this is quite an old thread, but I figured out what was causing the issue for me, so I thought I would comment here in case someone visits this thread in the future.

I opened Content.mgcb with JSON Editor (right click on Content.mgcb, then click on Open with…, then click on JSON Editor or some equivalent text editor). I then found that in this file there was a syntax error (for me it was a missing # at the beginning of an asset [the beginning of each asset starts with #begin]). Fixing the syntax error, then rebuilding (Build>Rebuild Solution in Visual Studio in the top bar) fixed the “Too many arguments” error. Hope this helps!

1 Like