hopefully fixed content builder errors

This commit is contained in:
foxnne 2019-09-21 20:12:30 -05:00
parent a63ff0184b
commit 5920d62e4d
6 changed files with 120 additions and 29 deletions

48
.vscode/tasks.json vendored
View File

@ -76,6 +76,7 @@
"command": "start",
"args": [
"/wait",
"\"project_name.exe\"", //names the console window
"${workspaceFolder}/project_name/bin/Debug/project_name.exe"
]
},
@ -94,7 +95,8 @@
"command": "start",
"args": [
"/wait",
"${workspaceFolder}/project_name/bin/Release/project_name.exe"
"\"project_name.exe\"", //names the console window
"${workspaceFolder}/project_name/bin/Release/project_name.exe"
]
},
"dependsOn": "Build (Release)",
@ -118,6 +120,50 @@
"problemMatcher": "$msCompile"
},
{
"label": "Build Content",
"type": "shell",
"group": "build",
"command": "msbuild /t:BuildContent",
"options": {
"cwd": "${workspaceFolder}/project_name"
},
"problemMatcher": "$msCompile"
},
{
"label": "Force Build Content",
"type": "shell",
"group": "build",
"osx": {
"command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb -r",
},
"windows": {
"command":"C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.exe",
"args": [
"/@:Content.mgcb",
"-r"
]
},
"options": {
"cwd": "${workspaceFolder}/project_name/CompiledContent"
},
"problemMatcher": "$msCompile"
},
{
"label": "Open Pipeline Tool",
"type": "shell",
"group": "build",
"osx": {
"command": "export MONOGAME_PIPELINE_PROJECT=${workspaceFolder}/project_name/CompiledContent/Content.mgcb && /Applications/Pipeline.app/Contents/MacOS/Pipeline"
},
"windows": {
"command": "${workspaceFolder}/project_name/CompiledContent/Content.mgcb"
},
"problemMatcher": "$msCompile"
},
{
"label": "Process T4 Templates",
"type": "shell",

View File

@ -11,6 +11,8 @@
Condition=" '$(OS)' != 'Windows_NT' And '$(MonoGameInstallDirectory)' == '' And Exists('/Library/Frameworks/Mono.framework/External/xbuild/MonoGame/v3.0/MonoGame.Common.props') ">/Library/Frameworks/Mono.framework/External/xbuild</MonoGameInstallDirectory>
<MonoGameInstallDirectory
Condition=" '$(MonoGameInstallDirectory)' == '' ">$(MSBuildProgramFiles32)</MonoGameInstallDirectory>
<MonoGameContentBuilderExe
Condition="'$(MonoGameContentBuilderExe)' == ''">$(MonoGameInstallDir)Tools\MGCB.exe</MonoGameContentBuilderExe>
<ContentOutputDir>bin/DesktopGL</ContentOutputDir>
<ContentIntermediateDir>obj/DesktopGL</ContentIntermediateDir>
</PropertyGroup>
@ -38,7 +40,7 @@
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/local/bin/mono') ">/usr/local/bin/mono</MonoExe>
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/usr/bin/mono') ">/usr/bin/mono</MonoExe>
<MonoExe Condition=" '$(OS)' != 'Windows_NT' And '$(MonoExe)' == '' ">mono</MonoExe>
<MonoGameContentBuilderExe Condition="'$(MonoGameContentBuilderExe)' == ''">$(MonoGameInstallDir)Tools\MGCB.exe</MonoGameContentBuilderExe>
<!-- <MonoGameContentBuilderExe Condition="'$(MonoGameContentBuilderExe)' == ''">$(MonoGameInstallDirectory)Tools\MGCB.exe</MonoGameContentBuilderExe> -->
<MonoGameContentBuilderCmd>"$(MonoGameContentBuilderExe)"</MonoGameContentBuilderCmd>
<MonoGameContentBuilderCmd Condition=" '$(OS)' != 'Windows_NT' ">$(MonoExe) $(MonoGameContentBuilderCmd)</MonoGameContentBuilderCmd>
<PlatformResourcePrefix Condition="'$(MonoGamePlatform)' == 'MacOSX'">$(MonoMacResourcePrefix)</PlatformResourcePrefix>
@ -50,17 +52,17 @@
<Header>/platform:$(MonoGamePlatform)</Header>
</PropertyGroup>
<Error
Text="The MonoGame content builder executable could not be located at '$(MonoGameContentBuilderExe)'!"
Condition="!Exists('$(MonoGameContentBuilderExe)')"
/>
<!-- Get all Mono Game Content References and store them in a list -->
<!-- We do this here so we are compatible with xbuild -->
<CollectContentReferences ContentReferences="@(MonoGameContentReference)" MonoGamePlatform="$(MonoGamePlatform)">
<Output TaskParameter="Output" ItemName="ContentReferences" />
</CollectContentReferences>
<Error
Text="The MonoGame content builder executable could not be located at '$(MonoGameContentBuilderExe)'!"
Condition="!Exists('$(MonoGameContentBuilderExe)')"
/>
<Warning
Text="No Content References Found. Please make sure your .mgcb file has a build action of MonoGameContentReference"
Condition=" '%(ContentReferences.FullPath)' == '' "
@ -85,7 +87,7 @@
</CreateItem>
</Target>
<Target Name="BuildContent" DependsOnTargets="Prepare;RunContentBuilder" AfterTargets="Build" Condition=" '@(MonoGameContentReference)' != '' "
<Target Name="BuildContent" DependsOnTargets="Prepare;RunContentBuilder" AfterTargets="Build" Condition=" '@(MonoGameContentReference)' != '' And Exists('$(MonoGameContentBuilderExe)')"
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)' != ''">

View File

@ -15,6 +15,21 @@ function checkDotnet()
}
}
function installT4 ()
{
if (checkDotnet) { Invoke-Expression 'dotnet tool install -g dotnet-t4' }
}
function checkGit ()
{
try { git | Out-Null }
catch [System.Management.Automation.CommandNotFoundException]
{
Write-Output "ERROR: Git is not installed. Please install git to download FNA."
exit
}
}
function checkMsbuild ()
{
try { msbuild | Out-Null }
@ -34,21 +49,6 @@ function check7zip ()
}
}
function installT4 ()
{
if (checkDotnet) { Invoke-Expression 'dotnet tool install -g dotnet-t4' }
}
function checkGit ()
{
try { git | Out-Null }
catch [System.Management.Automation.CommandNotFoundException]
{
Write-Output "ERROR: Git is not installed. Please install git to download FNA."
exit
}
}
function downloadFNA()
{
checkGit
@ -101,23 +101,19 @@ checkMsbuild
if (Test-Path "${PSScriptRoot}\FNA")
{
#if ((Read-Host -Prompt "Update FNA (y/n)?") -like 'y') { $shouldUpdate = true }
$shouldUpdate = Read-Host -Prompt "Update FNA (y/n)?"
}
else
{
#if ((Read-Host -Prompt "Download FNA (y/n)?") -like 'y') { $shouldDownload = true }
$shouldDownload = Read-Host -Prompt "Download FNA (y/n)?"
}
if (Test-Path "${PSScriptRoot}\fnalibs")
{
#if ((Read-Host -Prompt "Redownload fnalibs (y/n)?") -like 'y') { $shouldDownloadLibs = true }
$shouldDownloadLibs = Read-Host -Prompt "Redownload fnalibs (y/n)?"
}
else
{
#if ((Read-Host -Prompt "Download fnalibs (y/n)?") -like 'y') { $shouldDownloadLibs = true }
$shouldDownloadLibs = Read-Host -Prompt "Download fnalibs (y/n)?"
}
@ -177,5 +173,4 @@ dotnet restore "Nez/Nez.sln"
"Building..."
msbuild "Nez/Nez.sln"
msbuild -t:restore $newProjectName
msbuild -t:buildcontent $newProjectName
msbuild "${newProjectName}.sln"

View File

@ -0,0 +1,29 @@
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:HiDef
/compress:False
#-------------------------------- References --------------------------------#
/reference:../../Nez/Nez.PipelineImporter/bin/Debug/Newtonsoft.Json.dll
/reference:../../Nez/Nez.PipelineImporter/bin/Debug/Nez.PipelineImporter.dll
/reference:../../Nez/Nez.PipelineImporter/bin/Debug/Nez.dll
#---------------------------------- Content ---------------------------------#
#begin nez-logo-black.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:nez-logo-black.png

View File

@ -16,7 +16,7 @@ namespace project_name
.AddComponent<DemoComponent>()
.AddComponent(new PrototypeSprite(20, 20));
var logo = Content.Load<Texture2D>("nez-logo-black");
var logo = Content.LoadTexture("Textures/nez-logo-black");
CreateEntity("logo")
.SetPosition(Screen.Center)
.AddComponent(new SpriteRenderer(logo));

View File

@ -38,6 +38,25 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<!-- Include the CompiledContent bin (MGCB output). Copy it to the Content folder in the build. -->
<ItemGroup>
<Content Include="CompiledContent/bin/DesktopGL/**/*.xnb">
<Link>Content/%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<!-- cleanup so VS looks clean -->
<None Remove="CompiledContent\obj\**"/>
<None Remove="CompiledContent\bin\**"/>
<None Remove="CompiledContent\.*"/>
</ItemGroup>
<!-- MonoGames content pipeline needs this defined -->
<ItemGroup>
<MonoGameContentReference Include="CompiledContent\Content.mgcb"/>
</ItemGroup>
<Import Project="../MonoGameContent.targets"/>
<PropertyGroup>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>