Content project filename not passed to MGCB.exe

Following the problems mentioned in earlier threads, I reinstalled MonoGame using the dev installer and rebuilt my game project using the Universal App template. I’m using VS 2013 Express for Windows.

I am following Simon’s tutorial: http://darkgenesis.zenithmoon.com/all-hail-the-old-and-the-newthe-monogame-content-builder-tool/

When I created the .mgcb file I did get the correct icon but it was not automatically associated with the Pipeline.exe tool (I had to set this up myself). Is that normal? But the tool does at least open up the Content project correctly. However I get the following error at build time:

2>  Unhandled Exception: System.ArgumentException: Empty path name is not legal.
2>     at System.IO.File.ReadAllLines(String path)
2>     at MGCB.MGBuildParser.Preprocess(IEnumerable`1 args)
2>     at MGCB.MGBuildParser.Parse(IEnumerable`1 args)
2>     at MGCB.Program.Main(String[] args)
The command ""C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"" /platform:WindowsStoreApp /outputDir:"...\Content\bin\WindowsStoreApp" /intermediateDir:"...\Content\obj\WindowsStoreApp" /quiet" exited with code -532462766

Help?

I can run the Pipeline.exe tool manually using my .mgcb file, and when I “Build” in that tool, the output files are generated. It seems that MonoGame has not integrated properly into Visual Studio.

Unfortunately even if I build the content in Pipeline.exe, VS still tries to build the content project using MGCB.exe - and when it fails, my project build fails. :frowning:

Dug a bit deeper.

C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Content.Builder.targets contains the following:

<Exec Command="&quot;$(MonoGameContentBuilderExe)&quot; /@:&quot;%(ContentReferences.FullPath)&quot; $(Header)"
      WorkingDirectory="%(ContentReferences.RootDir)%(ContentReferences.Directory)" />

As you can see from the runline above, it seems that ContentReferences.RootDir and .Directory are defined, but that ContentReferences.FullPath is not defined in this context. If I hack the .targets file and give it a dummy filename, then MGCB.exe tries to open that file. If I use the filename of my .mgcb file then I believe the tool will build my project.

I don’t know enough about VS build config files to know what to do next. Maybe .FullPath is the wrong child node (I have tried a few random ideas but none of them were defined either), or maybe there is more I should have set up in Visual Studio (some prooperty or something I need to set). My .csproj looks like this:

<MonoGameContentReference Include="Content\SmallWorldGP.Windows.Content.mgcb" />

Should there be more attributes on that, for example?

I’ve updated to the latest binary install from http://teamcity.monogame.net/repository/download/MonoGame_DevelopWin/latest.lastSuccessful/Windows/MonoGameInstaller-3.2.exe?guest=1 and reinstalled MonoGame - but am still having the problem. Can anyone help me?

I was having this problem as well, after copying a solution and targeting a different platform. It seems like it still had links to the old Content.mgcb, so I removed and re-added it, but I think in not quite the same way the MonoGame template does it when it creates the project.

So I copy-pasted the XML block:

<ItemGroup>
<MonoGameContentReference Include=“Content\Content.mgcb” />
</ItemGroup>

From my source project to the new one, then I stopped getting the error.

I think it’s because without this tag the build process tries to point MGCB at an empty file.

Regards,
David

Thanks David, but I do have the cotnent reference in my project in that format. It doesn’t work. There must be something else missing.

Meanwhile I am building my content outside of Visual Studio and "Add as link"ing all the compiled .xnb files individually. Hardly ideal but it has got me going.

Tried a clean rebuild?

I wonder if it’s a problem with VS Express? Can you get a full version of Visual Studio installed? Maybe it’s worth re-creating your solution and starting with a fresh MonoGame project template.

You shouldn’t need to add all your xnb files as links btw… Just put them under the /bin/Content folder, and the contentmanager should point at the correct path.

Any updates? I am having the same issue as @pauliharman:

"C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"" /platform:Windows /outputDir:"E:\Prog\Visual Studio 2015\Projects\Fractals\Fractals\Content\bin\Windows" /intermediateDir:"E:\Prog\Visual Studio 2015\Projects\Fractals\Fractals\Content\obj\Windows" /quiet
Unhandled Exception: System.ArgumentException: Empty path name is not legal.

More information - this may be because I was working within an F# project. Creating a separate C# project for the content worked fine.

Using VS2015 Professional and MonoGame 3.4.0.456.

I had this problem because I had this in my csproj:

  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
  <ItemGroup>
    <MonoGameContentReference Include="Content\Content.mgcb" />
  </ItemGroup>

I needed to make sure the imports were at the very bottom, like this:

  <ItemGroup>
    <MonoGameContentReference Include="Content\Content.mgcb" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />

try to install vcredist_c++2013_x64 ou x86 is work
good work