Building our Content.mgcb file works fine when executed from Visual Studio or from the Pipeline tool itself. I am currently trying to get things working via a build script so we can get some build automation set up. However, I am running into problems due to the relative paths from the assets.
For reference, here are the paths where everything is located:
Content.mgcb - D:\project\code\project\Content
MGCB.exe - D:\project\bin
BuildAssets.bat - D:\project\bin
Debug.spritefont - D:\project\assets\fonts
I am running BuildAssets.bat, which simply runs the following:
MGCB.exe /platform:Windows /@:…/code/project/Content/Content.mgcb /outputDir:Content /intermediateDir:ContentTemp
And finally, the important parts of the Content.mgcb file:
#----------------------------- Global Properties ----------------------------#
/outputDir:..\..\..\bin\Content
/intermediateDir:obj/$(Platform)
/platform:Windows
/config:
/profile:Reach
/compress:False
#---------------------------------- Content ---------------------------------#
#begin ../../../assets/fonts/Debug.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:../../../assets/fonts/Debug.spritefont;Fonts/Debug.spritefont
The errors I’m seeing are:
D:/project/bin/…/…/…/assets/fonts/Debug.spritefont
D:/project/bin/…/…/…/assets/fonts/Debug.spritefont: error: The source file ‘D:/project/bin/…/…/…/assets/fonts/Debug.spritefont’ does not exist!
The error makes sense, because that relative path is the path from the Content file, not the MGCB exe. But why is looking for a relative path from where the MGCB file is called instead of the Content file. Is this a bug? I tried setting the workingDir but I still got the same error (though it did properly change where it made the Content and ContentTemp folders).
I’m sure I could hack around this but updating my batch file to change the directory to where the Content file is run and execute everything from there, but it seems like this isn’t something I should need to do. Has anyone run into similar issues or been able to successfully build their Content file from a different directory?