Changing ContentRoot directory, MonoGame still builds into "Content" folder

I’ve changed my Content.RootDirectory to “Data” countless times in XNA without any trouble, with MonoGame tho I’m running into problems.

Adding my built content into my project and having them as “copy if newer” makes all content go to the right folder, however certain files also show up in the built folder under Content/Audio/myfile.xnb, without there being a string anywhere telling it to send the files there.

I’ve changed output directory, intermediate directory, but still MonoGame creates a “Content” folder with bin and obj folders while building, and settles on making a Content folder in my output directory with some of the content files.

I’ve narrowed this down to the build action on the Data.mgcb file itself, if I set it to not build, I get an error and it shows me the command line on building it:

Error    76    The command ""C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"" /platform:Windows /outputDir:"E:\Dev\SVN\jsmars\source\jsmars\Content\bin\Windows" /intermediateDir:"E:\Dev\SVN\jsmars\source\jsmars\Content\obj\Windows" /quiet" exited with code -532462766.    C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Content.Builder.targets    67    5    jsmars

and there you can see /outputDir and /intermediateDir setting a “Content” directory, why doesnt this follow the directories specified in the file?

#----------------------------- Global Properties ----------------------------#

/outputDir:..\Data
/intermediateDir:obj/Windows
/platform:Windows
/config:
/profile:HiDef
/compress:False

#-------------------------------- References --------------------------------#


#---------------------------------- Content ---------------------------------#

#begin Audio/click.wav
/importer:WavImporter
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:Audio/click.wav

#begin Fonts/font1.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:TextureFormat=Compressed
/build:Fonts/font1.spritefont

When I build the monogame content project from the MonoGame Pipeline tool, everything builds as it should, it is only when it’s build through visual studios build action that this wierd behaviour shows itself. I could always not include the content file, but I’d like to have it in there to be sure content is always built and up to date.

This is an old question but I recently was trying to do the same thing, so hopefully it will be useful to anyone who comes across this answer.

What I did was edit the file located at
Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Content.Builder.targets

I commented the following lines:

<ParentOutputDir Condition=" '$(ParentOutputDir)' == '' " >$(ProjectDir)$(ContentRootDirectory)\bin\$(MonoGamePlatform)</ParentOutputDir>
<ParentIntermediateDir Condition=" '$(ParentIntermediateDir)' == '' " >$(ProjectDir)$(ContentRootDirectory)\obj\$(MonoGamePlatform)</ParentIntermediateDir>

And added these modified copies instead:

<ParentOutputDir Condition=" '$(ParentOutputDir)' == '' " >$(ProjectDir)$(ContentRootDirectory)\..\$(MonoGamePlatform)</ParentOutputDir>
<ParentIntermediateDir Condition=" '$(ParentIntermediateDir)' == '' " >$(ProjectDir)\obj\$(MonoGamePlatform)</ParentIntermediateDir>

This way, I am storing my .mgcb file at the same level as my .csproj, and it outputs the build results into the Content folder. I can easily modify the .csproj to include all files built by adding the tag to my .csproj file:

<ItemGroup>
  <Content Include="Content\**\*.*">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
</ItemGroup>