How to use the Content Pipeline Tool with VSCode

Hi. I’m currently using VSCode and the .NET Core SDK to generate a new MonoGame project.

Using the ‘dotnet new mgdesktopgl’ command I’m able to generate the necessary files to build and run the code. The problem is, I don’t know how to execute the Content Pipeline Tool via VSCode.

On Visual Studio, you’re able to open the Content.mgcb file and display a GUI. Is it possible to do the same on VSCode, or at least use it as a command line tool?

It’s actually all a command line tools and in Visual Studio it’s just defined in the monogame targets file.

Look this file up: \MSBuild\MonoGame\v3.0\MonoGame.Content.Builder.targets (if you dont have VS installed, you can find it in the MG sources I guess)

in the bottom of the file you’ll find the Targets for Building the Content and running the ContentBuilder

<Target Name="RunContentBuilder">
    <Exec Condition=" '%(ContentReferences.FullPath)' != '' "
          Command="$(MonoGameContentBuilderCmd) $(MonoGameMGCBAdditionalArguments) /@:&quot;%(ContentReferences.FullPath)&quot; $(Header) /outputDir:&quot;%(ContentReferences.ContentOutputDir)&quot; /intermediateDir:&quot;%(ContentReferences.ContentIntermediateOutputDir)&quot;"
          WorkingDirectory="%(ContentReferences.RootDir)%(ContentReferences.Directory)" />
     <CreateItem Include="%(ContentReferences.RelativeFullPath)%(ContentReferences.ContentOutputDir)\**\*.*"
            AdditionalMetadata="ContentOutputDir=%(ContentReferences.ContentDirectory)">
        <Output TaskParameter="Include" ItemName="ExtraContent" />
    </CreateItem>
  </Target>

  <Target Name="BuildContent" DependsOnTargets="Prepare;RunContentBuilder"
          Condition=" '@(MonoGameContentReference)' != '' "
          Outputs="%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension)">

    <CreateItem Include="%(ExtraContent.FullPath)"
         AdditionalMetadata="Link=$(PlatformResourcePrefix)%(ExtraContent.ContentOutputDir)%(ExtraContent.RecursiveDir)%(ExtraContent.Filename)%(ExtraContent.Extension);CopyToOutputDirectory=PreserveNewest"
         Condition="'%(ExtraContent.Filename)' != ''">
      <Output TaskParameter="Include" ItemName="Content" Condition="'$(MonoGamePlatform)' != 'Android' And '$(MonoGamePlatform)' != 'iOS' And '$(MonoGamePlatform)' != 'MacOSX'" />
      <Output TaskParameter="Include" ItemName="BundleResource" Condition="'$(MonoGamePlatform)' == 'MacOSX' Or '$(MonoGamePlatform)' == 'iOS'" />
      <Output TaskParameter="Include" ItemName="AndroidAsset" Condition="'$(MonoGamePlatform)' == 'Android'" />
    </CreateItem>
  </Target>

where the ContentBuilderExe is basically MGCB.exe

it’s a little bit hard to read, but you should be able to get all command line parameters and executables from there, I guess.

just a point to start, I am sure, someone can give you more detailled information about it