From 7975cccbe99cbd66cc9f66b0527e5c889e81f56d Mon Sep 17 00:00:00 2001 From: foxnne Date: Sun, 1 Sep 2019 01:01:40 -0500 Subject: [PATCH 01/10] Ported bash files to powershell, now functions in Windows Still need to fix up a few lingering things. Need to figure out how the original sln file was functioning with Release configuration without having a Release config set up. Would also be nice to have some way to install and run the powershell script from code, so it would be as simple as creating the folder for the new project > right click > open with Code > (run command from pallette for new Nez project from template) --- .vscode/buildEffects.ps1 | 23 +++++ .vscode/processT4Templates.ps1 | 25 +++++ .vscode/tasks.json | 22 +++-- MonoGameContent.targets | 4 +- MonoGameContent.targets.bak | 93 ++++++++++++++++++ getFNA.ps1 | 174 +++++++++++++++++++++++++++++++++ getFNA.sh | 171 -------------------------------- 7 files changed, 330 insertions(+), 182 deletions(-) create mode 100644 .vscode/buildEffects.ps1 create mode 100644 .vscode/processT4Templates.ps1 create mode 100644 MonoGameContent.targets.bak create mode 100644 getFNA.ps1 delete mode 100755 getFNA.sh diff --git a/.vscode/buildEffects.ps1 b/.vscode/buildEffects.ps1 new file mode 100644 index 0000000..23bf379 --- /dev/null +++ b/.vscode/buildEffects.ps1 @@ -0,0 +1,23 @@ +#!/bin/bash +# buildEffects +# Compiles all .fx files found in the project's Content directory. +# Intended for usage with VS Code Build Tasks tooling. +# You may need to change the path to fxc.exe depending on your installation. + +Write-Output "Starting build process..." + +Set-Location ../project_name + +$fxc = "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" + +$files = Get-ChildItem -Path "Content\*" -Include *fx + +foreach ($file in $files) +{ + $fileName = $file.BaseName + $filePath = $file.FullName + & $fxc /T fx_2_0 $filePath /Fo "${filePath}b" + + Write-Output "Built ${fileName}.fx to ${filePath}b" +} + diff --git a/.vscode/processT4Templates.ps1 b/.vscode/processT4Templates.ps1 new file mode 100644 index 0000000..b70f07a --- /dev/null +++ b/.vscode/processT4Templates.ps1 @@ -0,0 +1,25 @@ +#!/bin/bash +# buildEffects +# Compiles all .fx files found in the project's Content directory. +# Intended for usage with VS Code Build Tasks tooling. +# You may need to change the path to fxc.exe depending on your installation. + +Write-Output "Starting T4 processing..." + +Set-Location ../project_name + +# create our output directory +if ((Test-Path("T4Templates")) -eq 0) { New-Item -ItemType "directory" -Path "T4Templates" } +if ((Test-Path("T4Templates\Output")) -eq 0) { New-Item -ItemType "directory" -Path "T4Templates\Output"} + +$files = Get-ChildItem ".\T4Templates\*" -Include *.tt + +foreach ($file in $files) +{ + $fileName = $file.BaseName + # Build the template + t4 -r System.dll -r mscorlib.dll -r netstandard.dll -r System.IO.FileSystem.dll -r System.Linq.dll -r System.Text.RegularExpressions -o "T4Templates\Output\${fileName}.cs" "T4Templates\${fileName}.tt" + Write-Output "Built ${fileName}.cs from ${fileName}.tt" +} + + diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bf8d65f..718ba17 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -16,7 +16,7 @@ // - clean, restore and rebuild Nez.FNA.sln (nuget restore Nez.FNA) "label": "Update, Restore and Rebuild Nez", "type": "shell", - "command": "git submodule foreach --recursive git pull && msbuild Nez/Nez.sln '/t:clean;restore;build' && msbuild Nez/Nez.FNA.sln '/t:clean;restore;build'", + "command": "git submodule foreach --recursive git pull && msbuild Nez/Nez.sln /t:clean /t:restore && msbuild Nez/Nez.FNA.sln /t:clean /t:restore", "group": "build", "problemMatcher": "$msCompile", "presentation": { @@ -32,7 +32,7 @@ { "label": "Clean Project", "type": "shell", - "command": "msbuild project_name /t:clean /p:configuration=Debug ; msbuild project_name /t:clean /p:configuration=Release", + "command": "msbuild project_name /t:clean /p:configuration=Debug && msbuild project_name /t:clean /p:configuration=Release", "group": "build", "problemMatcher": "$msCompile", }, @@ -42,8 +42,9 @@ "type": "shell", "command": "msbuild", "args": [ - "project_name", + "project_name.sln", "/p:configuration=Debug", + "/p:platform=Any CPU", "/t:build" ], "group": "build", @@ -51,13 +52,15 @@ "dependsOn": "Build Content", }, + //Confused how release works with this template by default, no release config seems to be setup in the sln { "label": "Build (Release)", "type": "shell", "command": "msbuild", "args": [ - "project_name", + "project_name.sln", "/p:configuration=Release", + "/p:platform=Any CPU", "/t:build" ], "group": "build", @@ -105,7 +108,7 @@ "type": "shell", "group": "build", "osx":{ - "command": "${workspaceFolder}/.vscode/buildEffects.sh" + "command": "${workspaceFolder}/.vscode/buildEffects.ps1" }, "windows":{ "command": "& ${workspaceFolder}/.vscode/buildEffects.ps1" @@ -124,7 +127,8 @@ "problemMatcher": "$msCompile" }, - { + //I dont fully understand this function or how to replicate on windows. + /* { "label": "Force Build Content", "type": "shell", "group": "build", @@ -133,20 +137,20 @@ "cwd": "${workspaceFolder}/project_name/CompiledContent" }, "problemMatcher": "$msCompile" - }, + }, */ { "label": "Open Pipeline Tool", "type": "shell", "group": "build", - "command": "export MONOGAME_PIPELINE_PROJECT=${workspaceFolder}/project_name/CompiledContent/Content.mgcb && /Applications/Pipeline.app/Contents/MacOS/Pipeline", + "command": "${workspaceFolder}/lucid/CompiledContent/Content.mgcb", "problemMatcher": "$msCompile" }, { "label": "Process T4 Templates", "type": "shell", - "command": "${workspaceFolder}/.vscode/processT4Templates.sh", + "command": "${workspaceFolder}/.vscode/processT4Templates.ps1", "group": "build", "problemMatcher": "$msCompile", }, diff --git a/MonoGameContent.targets b/MonoGameContent.targets index fa00c36..9978756 100644 --- a/MonoGameContent.targets +++ b/MonoGameContent.targets @@ -6,7 +6,7 @@ /Library/Frameworks/Mono.framework/External/xbuild + Condition=" '$(MonoGameInstallDirectory)' == '' And Exists('C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Common.props') ">C:\Program Files (x86)\MSBuild $(MSBuildProgramFiles32) bin/DesktopGL @@ -14,7 +14,7 @@ + AssemblyFile="C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Build.Tasks.dll" /> diff --git a/MonoGameContent.targets.bak b/MonoGameContent.targets.bak new file mode 100644 index 0000000..fa00c36 --- /dev/null +++ b/MonoGameContent.targets.bak @@ -0,0 +1,93 @@ + + + + /Library/Frameworks/Mono.framework/External/xbuild + $(MSBuildProgramFiles32) + bin/DesktopGL + obj/DesktopGL + + + + + + + + + + + + true + + + + + $(MonoGameInstallDirectory)\MonoGame\v3.0\ + + /Library/Frameworks/Mono.framework/Versions/Current/bin/mono + /usr/local/bin/mono + /usr/bin/mono + mono + $(MonoGameInstallDir)Tools\MGCB.exe + "$(MonoGameContentBuilderExe)" + $(MonoExe) $(MonoGameContentBuilderCmd) + $(MonoMacResourcePrefix) + $(IPhoneResourcePrefix) + $(MonoAndroidAssetsPrefix) + $(PlatformResourcePrefix)\ + + /quiet +
/platform:$(MonoGamePlatform)
+
+ + + + + + + + + + +
+ + + + + BuildContent; + $(BuildDependsOn); + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/getFNA.ps1 b/getFNA.ps1 new file mode 100644 index 0000000..46eee3a --- /dev/null +++ b/getFNA.ps1 @@ -0,0 +1,174 @@ +#!/bin/bash +# Program: getFNA +# Author: Caleb Cornett (converted to powershell to work with windows) +# Usage: ./getFNA.sh +# Description: Quick and easy way to install a local copy of FNA and its native libraries. + +# Checks if dotnet is installed +function checkDotnet() +{ + try + { + dotnet | Out-Null + return 1 + } + catch [System.Management.Automation.CommandNotFoundException] + { + Write-Output "ERROR: Dotnet is not installed. Please install dotnet to download the t4 tool." + return 0 + } +} + +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 + git -C $PSScriptRoot clone https://github.com/FNA-XNA/FNA.git --recursive + + if ($? -eq 1) { Write-Output "Finished Downloading!" } + else { Write-Output "ERROR: Download failed, try again later?" exit} + +} + +function updateFNA () +{ + checkGit + Write-Output "Updating to the latest git version of FNA..." + + git -C "${PSScriptRoot}\FNA" pull --recurse-submodules + + if ($? -eq 1) { Write-Output "Finished updating!" } + else { Write-Output "ERROR: Unable to update." exit} +} + +function check7zip () +{ + try + { + 7z | Out-Null + } + catch [System.Management.Automation.CommandNotFoundException] + { + Write-Output "ERROR: 7Zip is not installed. Please install 7Zip and set PATH Environment Variable and try again." + exit + } +} + +function getLibs () +{ + Write-Output "Downloading the latest FNAlibs..." + Invoke-WebRequest -Uri http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 -OutFile "${PSScriptRoot}/fnalibs.tar.bz2" + if ($? -eq 1) { Write-Output "Finished downloading!" } + else { Write-Output "ERROR: Unable to download successfully." exit} + + Write-Output "Decompressing fnalibs..." + check7zip + if ((Test-Path "${PSScriptRoot}\fnalibs") -eq 0) + { + 7z x "fnalibs.tar.bz2" + if ($? -eq 1){ Remove-Item "fnalibs.tar.bz2"} + else { Write-Output "ERROR: Unable to decompress successfully." exit } + 7z x "fnalibs.tar" -ofnalibs + if ($? -eq 1) + { + Remove-Item "fnalibs.tar" + Write-Output "Finished decompressing!" + } + else { Write-Output "ERROR: Unable to decompress successfully." exit } + } + +} + + +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)?" +} + +if ((Test-Path "${PSScriptRoot}\project_name") -eq 1) +{ + $newProjectName = Read-Host -Prompt "Enter the project name to use for your folder and csproj file or 'exit' to quit: " +} + +if ($shouldDownload -like 'y') { downloadFNA } +elseif ($shouldUpdate -like 'y') { updateFNA } + +if ($shouldDownloadLibs -like 'y') { getLibs } + +installT4 + +# Only proceed from here if we have not yet renamed the project +if ((Test-Path "${PSScriptRoot}\project_name") -ne 1) { exit } + + +if ($newProjectName -eq "exit" -or $newProjectName -eq "") { exit } + +$files= "project_name.sln", + ".gitignore", + "project_name/project_name.csproj", + "project_name/Game1.cs", + "project_name/DemoComponent.cs", + "project_name/DefaultScene.cs", + "project_name/Program.cs", + ".vscode/tasks.json", + ".vscode/settings.json", + ".vscode/launch.json", + ".vscode/buildEffects.sh", + ".vscode/processT4Templates.sh", + ".vscode/buildEffects.ps1", + ".vscode/processT4Templates.ps1" + +foreach ($file in $files) +{ + ((Get-Content -Path $file -Raw) -replace 'project_name', $newProjectName) | Set-Content -Path $file +} + +Rename-Item -Path "project_name.sln" -NewName "${newProjectName}.sln" +Rename-Item -Path "project_name/project_name.csproj" -NewName "${newProjectName}.csproj" +Rename-Item -Path "project_name/project_name.csproj.user" -NewName "${newProjectName}.csproj.user" +Rename-Item -Path "project_name" -NewName $newProjectName + +git init +git submodule add https://github.com/prime31/Nez.git +Set-Location Nez +git submodule init +git submodule update + +"Restoring and rebuilding..." +Set-Location $PSScriptRoot +dotnet restore "Nez/Nez.sln" +msbuild "Nez/Nez.sln" +msbuild -t:restore $newProjectName +msbuild -t:buildcontent $newProjectName +msbuild "${newProjectName}.sln" diff --git a/getFNA.sh b/getFNA.sh deleted file mode 100755 index 9ba3ce4..0000000 --- a/getFNA.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash -# Program: getFNA -# Author: Caleb Cornett -# Usage: ./getFNA.sh -# Description: Quick and easy way to install a local copy of FNA and its native libraries. - -# Checks if dotnet is installed -function checkDotnet() -{ - # || { echo >&2 "ERROR: dotnet is not installed. Please install dotnet to download the t4 tool."; exit 1; } - command -v dotnet > /dev/null 2>&1 - if [ ! $? -eq 0 ]; then - echo >&2 "ERROR: dotnet is not installed. Please install dotnet to download the t4 tool." - exit 1 - fi -} - -# Checks if t4 is installed and installs it if it isnt -function installT4() -{ - checkDotnet - command -v t4 > /dev/null 2>&1 - if [ ! $? -eq 0 ]; then - dotnet tool install -g dotnet-t4 - fi -} - -# Checks if git is installed -function checkGit() -{ - git --version > /dev/null 2>&1 - if [ ! $? -eq 0 ]; then - echo >&2 "ERROR: Git is not installed. Please install git to download FNA." - exit 1 - fi -} - -# Clones FNA from the git master branch -function downloadFNA() -{ - checkGit - echo "Downloading FNA..." - git -C $MY_DIR clone https://github.com/FNA-XNA/FNA.git --recursive - if [ $? -eq 0 ]; then - echo "Finished downloading!" - else - echo >&2 "ERROR: Unable to download successfully. Maybe try again later?" - fi -} - -# Pulls FNA from the git master branch -function updateFNA() -{ - checkGit - echo "Updating to the latest git version of FNA..." - git -C "$MY_DIR/FNA" pull --recurse-submodules - if [ $? -eq 0 ]; then - echo "Finished updating!" - else - echo >&2 "ERROR: Unable to update." - exit 1 - fi -} - - -# Downloads and extracts prepackaged archive of native libraries ("fnalibs") -function getLibs() -{ - # Downloading - echo "Downloading latest fnalibs..." - curl http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 > "$MY_DIR/fnalibs.tar.bz2" - if [ $? -eq 0 ]; then - echo "Finished downloading!" - else - >&2 echo "ERROR: Unable to download successfully." - exit 1 - fi - - # Decompressing - echo "Decompressing fnalibs..." - mkdir -p $MY_DIR/fnalibs - tar xjC $MY_DIR/fnalibs -f $MY_DIR/fnalibs.tar.bz2 - if [ $? -eq 0 ]; then - echo "Finished decompressing!" - echo "" - rm $MY_DIR/fnalibs.tar.bz2 - else - >&2 echo "ERROR: Unable to decompress successfully." - exit 1 - fi -} - -# Get the directory of this script -MY_DIR=$(dirname "$BASH_SOURCE") - - -# gather input - -# FNA -if [ ! -d "$MY_DIR/FNA" ]; then - read -p "Download FNA (y/n)? " shouldDownload -else - read -p "Update FNA (y/n)? " shouldUpdate -fi - -if [ ! -d "$MY_DIR/fnalibs" ]; then - read -p "Download fnalibs (y/n)? " shouldDownloadLibs -else - read -p "Redownload fnalibs (y/n)? " shouldDownloadLibs -fi - - -# act on the input - -# FNA -if [[ $shouldDownload =~ ^[Yy]$ ]]; then - downloadFNA -elif [[ $shouldUpdate =~ ^[Yy]$ ]]; then - updateFNA -fi - -# FNALIBS -if [[ $shouldDownloadLibs =~ ^[Yy]$ ]]; then - getLibs -fi - - -# install t4 engine -installT4 - - - -# Only proceed from here if we have not yet renamed the project -if [ ! -d "$MY_DIR/project_name" ]; then - # old project_name folder already renamed so we are all done here - exit 1 -fi - - -read -p "Enter the project name to use for your folder and csproj file or 'exit' to quit: " newProjectName -if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then - exit 1 -fi - -# any files that need to have project_name replaced with the new project name should be here -files=(project_name.sln .gitignore project_name/project_name.csproj project_name/Game1.cs project_name/DemoComponent.cs project_name/DefaultScene.cs project_name/Program.cs .vscode/tasks.json .vscode/settings.json .vscode/launch.json .vscode/buildEffects.sh .vscode/processT4Templates.sh) -for file in "${files[@]}"; do - sed -i '' "s/project_name/$newProjectName/g" $file -done - -mv project_name.sln "$newProjectName.sln" -mv project_name/project_name.sln "project_name/$newProjectName.sln" -mv project_name/project_name.csproj "project_name/$newProjectName.csproj" -mv project_name/project_name.csproj.user "project_name/$newProjectName.csproj.user" -mv project_name "$newProjectName" - -git init -git submodule add https://github.com/prime31/Nez.git -cd Nez -git submodule init -git submodule update - -command -v pbcopy > /dev/null 2>&1 -if [ ! $? -eq 0 ]; then - printf "\n\nManually run the following command:\n\nnuget restore Nez/Nez.sln && msbuild Nez/Nez.sln && msbuild /t:restore $newProjectName && msbuild $newProjectName.sln\n\n" -else - echo "nuget restore Nez/Nez.sln && msbuild Nez/Nez.sln && msbuild /t:restore $newProjectName && msbuild $newProjectName.sln" | pbcopy - echo "" - echo "A build command was copied to your clipboard. Paste and run it now." - echo "" -fi From 3e5a7e6a78474d0cd896ab828951caf7dc499cab Mon Sep 17 00:00:00 2001 From: foxnne Date: Mon, 2 Sep 2019 17:49:21 -0500 Subject: [PATCH 02/10] Nearly finalized, added back all the osx compatibility. Hopefully this now works with both OSX and Windows... I tried to create platform specific properties everywhere I could. All Windows build tasks for VSCode seem to be working correctly now. --- .vscode/buildEffects.ps1 | 2 +- .vscode/launch.json | 42 ++++++-- .vscode/settings.json | 1 + .vscode/tasks.json | 43 +++++--- MonoGameContent.targets | 10 +- MonoGameContent.targets.bak | 93 ----------------- README.md | 8 +- getFNA.ps1 | 76 ++++++++++++-- getFNA.sh | 171 +++++++++++++++++++++++++++++++ project_name.sln | 13 ++- project_name/DemoComponent.cs | 11 +- project_name/Game1.cs | 8 +- project_name/project_name.csproj | 1 + 13 files changed, 345 insertions(+), 134 deletions(-) delete mode 100644 MonoGameContent.targets.bak create mode 100644 getFNA.sh diff --git a/.vscode/buildEffects.ps1 b/.vscode/buildEffects.ps1 index 23bf379..0f5a719 100644 --- a/.vscode/buildEffects.ps1 +++ b/.vscode/buildEffects.ps1 @@ -10,7 +10,7 @@ Set-Location ../project_name $fxc = "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" -$files = Get-ChildItem -Path "Content\*" -Include *fx +$files = Get-ChildItem -Path "Content\*" -Recurse -Include *fx foreach ($file in $files) { diff --git a/.vscode/launch.json b/.vscode/launch.json index de33671..3587b54 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,16 +1,44 @@ { - // Change "mono" to "clr" for 64-bit .NET Framework debugging on Windows. + // Delete unnecessary configurations if unneeded. "type" isnt supported for platform specifc properties. // (See: https://github.com/OmniSharp/omnisharp-vscode/wiki/Desktop-.NET-Framework) "version": "0.2.0", "configurations": [ + { - "name": "Launch", + "name": "Launch (Mac)", "type": "mono", "request": "launch", "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", "cwd": "${workspaceFolder}/project_name", "preLaunchTask": "Build (Debug)", + "osx":{ + "env": { + "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" + }, + }, + }, + + { + "name": "Launch Without Building (Mac)", + "type": "mono", + "request": "launch", + "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", + "cwd": "${workspaceFolder}", + "osx":{ + "env": { + "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" + }, + } + }, + + { + "name": "Launch (Windows)", + "type": "clr", + "request": "launch", + "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", + "cwd": "${workspaceFolder}/project_name", + "preLaunchTask": "Build (Debug)", "osx":{ "env": { "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" @@ -19,14 +47,14 @@ }, { - "name": "Launch Without Building", - "type": "mono", + "name": "Launch Without Building (Windows)", + "type": "clr", "request": "launch", - "program": "${workspaceFolder}/Fook/bin/Debug/Fook.exe", + "program": "${workspaceFolder}/project_name/bin/Debug/project_name.exe", "cwd": "${workspaceFolder}", "osx":{ "env": { - "DYLD_LIBRARY_PATH": "${workspaceFolder}/Fook/bin/Debug/osx/" + "DYLD_LIBRARY_PATH": "${workspaceFolder}/project_name/bin/Debug/osx/" }, } }, @@ -39,4 +67,4 @@ "port": 55555 } ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 2882144..d6d3a8c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,7 @@ "**/.[^v]*": true, // hide any files that start with a '.' but keep the .vscode folder ".vs": true, // Visual Studio settings "getFNA.sh": true, + "getFNA.ps1": true, "imgui.ini": true, "MonoGameContent.targets": true, "**/obj": true, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 718ba17..851db23 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -52,7 +52,6 @@ "dependsOn": "Build Content", }, - //Confused how release works with this template by default, no release config seems to be setup in the sln { "label": "Build (Release)", "type": "shell", @@ -75,9 +74,10 @@ "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/project_name/bin/Debug/osx/ mono ${workspaceFolder}/project_name/bin/Debug/project_name.exe" }, "windows":{ - "command": "cmd", + "command": "start", "args": [ - "/k", + "/wait", + "${workspaceFolder}/project_name/bin/Debug/project_name.exe", "${workspaceFolder}/project_name/bin/Debug/project_name.exe" ] }, @@ -93,9 +93,10 @@ "command": "DYLD_LIBRARY_PATH=${workspaceFolder}/project_name/bin/Release/osx/ mono ${workspaceFolder}/project_name/bin/Release/project_name.exe" }, "windows":{ - "command": "cmd", + "command": "start", "args": [ - "/k", + "/wait", + "${workspaceFolder}/project_name/bin/Release/project_name.exe", "${workspaceFolder}/project_name/bin/Release/project_name.exe" ] }, @@ -108,7 +109,7 @@ "type": "shell", "group": "build", "osx":{ - "command": "${workspaceFolder}/.vscode/buildEffects.ps1" + "command": "${workspaceFolder}/.vscode/buildEffects.sh" }, "windows":{ "command": "& ${workspaceFolder}/.vscode/buildEffects.ps1" @@ -127,30 +128,48 @@ "problemMatcher": "$msCompile" }, - //I dont fully understand this function or how to replicate on windows. - /* { + { "label": "Force Build Content", "type": "shell", "group": "build", - "command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb -r", + "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", - "command": "${workspaceFolder}/lucid/CompiledContent/Content.mgcb", + "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", - "command": "${workspaceFolder}/.vscode/processT4Templates.ps1", + "osx": { + "command": "${workspaceFolder}/.vscode/processT4Templates.sh" + }, + "windows": { + "command": "& ${workspaceFolder}/.vscode/processT4Templates.ps1" + }, "group": "build", "problemMatcher": "$msCompile", }, diff --git a/MonoGameContent.targets b/MonoGameContent.targets index 9978756..c5acfa8 100644 --- a/MonoGameContent.targets +++ b/MonoGameContent.targets @@ -6,16 +6,20 @@ C:\Program Files (x86)\MSBuild + Condition=" '$(OS)' == 'Windows_NT' And '$(MonoGameInstallDirectory)' == '' And Exists('C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGame.Common.props') ">C:\Program Files (x86)\MSBuild + /Library/Frameworks/Mono.framework/External/xbuild $(MSBuildProgramFiles32) bin/DesktopGL obj/DesktopGL - - + + diff --git a/MonoGameContent.targets.bak b/MonoGameContent.targets.bak deleted file mode 100644 index fa00c36..0000000 --- a/MonoGameContent.targets.bak +++ /dev/null @@ -1,93 +0,0 @@ - - - - /Library/Frameworks/Mono.framework/External/xbuild - $(MSBuildProgramFiles32) - bin/DesktopGL - obj/DesktopGL - - - - - - - - - - - - true - - - - - $(MonoGameInstallDirectory)\MonoGame\v3.0\ - - /Library/Frameworks/Mono.framework/Versions/Current/bin/mono - /usr/local/bin/mono - /usr/bin/mono - mono - $(MonoGameInstallDir)Tools\MGCB.exe - "$(MonoGameContentBuilderExe)" - $(MonoExe) $(MonoGameContentBuilderCmd) - $(MonoMacResourcePrefix) - $(IPhoneResourcePrefix) - $(MonoAndroidAssetsPrefix) - $(PlatformResourcePrefix)\ - - /quiet -
/platform:$(MonoGamePlatform)
-
- - - - - - - - - - -
- - - - - BuildContent; - $(BuildDependsOn); - - - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/README.md b/README.md index 581d540..578d12f 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,18 @@ Start new FNA projects with Nez quickly and easily with handy setup scripts, a v ## Prerequisites ## -- [Visual Studio Code](https://code.visualstudio.com) or [Visual Studio](https://visualstudio.microsoft.com/) (recommended to use Visual Studio Code because it has some custom tasks but either will work fine) - - [Mono Debugger Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.mono-debug) (required for macOS debugging) +- [Visual Studio Code](https://code.visualstudio.com) or [Visual Studio](https://visualstudio.microsoft.com/) (recommended to use Visual Studio Code because it has some custom tasks but either will work fine.) +- [Mono Debugger Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.mono-debug) (required for macOS debugging) - [MonoGame](http://www.monogame.net/downloads/) (required for compiling content with the Pipeline tool) - (optional) [.NET Core](https://dotnet.microsoft.com/download) (required for compiling T4 templates) - (optional) [Microsoft DirectX SDK (June 2010)](https://www.microsoft.com/en-us/download/details.aspx?id=6812) (required for building effects, [you can use Wine to run this](https://github.com/AndrewRussellNet/FNA-Template#linuxmacos-installing-the-directx-sdk-on-wine)) +- (windows only) [7zip](https://www.7-zip.org) (if intending to use fnalibs, the filetype is unsupported for windows and requires 7zip to be installed to decompress/unzip) +- (windows only) [Build tools for Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16)(these build tools are required for all Visual Studio Code build tasks. if you intend to use the full Visual Studio, these are already included. be sure to include .NET Core Build Tools in the installation) ## Setup Instructions ## 1. Download and unzip the ZIP archive (don't clone the repo!) -2. Run `./getFNA.sh` (macOS) to download the latest Nez, FNA and fnalibs to the directory. You can run this script again if you want to update either FNA or the fnalibs at a later point. +2. Run `./getFNA.sh` (macOS) or `./getFNA.ps1` (windows) to download the latest Nez, FNA and fnalibs to the directory. You can run this script again if you want to update either FNA or the fnalibs at a later point. 3. Open the root folder that contains the .sln file in Visual Studio Code or the .sln file directly in Visual Studio. Note that only Visual Studio Code has an effect builder command. That's it! Now you're ready to build and run the base project. If you get missing DLL errors (pointing at SDL) when running in Visual Studio copy the FNA libs into your `/usr/local/lib` folder. With Visual Studio Code, `DYLD_LIBRARY_PATH` is set automatically so it won't run into the DLL not found error. Nez is setup as a submodule so you can update it in the normal fashion. diff --git a/getFNA.ps1 b/getFNA.ps1 index 46eee3a..cb8288f 100644 --- a/getFNA.ps1 +++ b/getFNA.ps1 @@ -57,13 +57,9 @@ function updateFNA () function check7zip () { - try + if ((Test-Path "C:\Program Files\7-Zip") -eq 0) { - 7z | Out-Null - } - catch [System.Management.Automation.CommandNotFoundException] - { - Write-Output "ERROR: 7Zip is not installed. Please install 7Zip and set PATH Environment Variable and try again." + Write-Output "ERROR: 7zip is not installed, please install 7zip and try again." exit } } @@ -79,10 +75,10 @@ function getLibs () check7zip if ((Test-Path "${PSScriptRoot}\fnalibs") -eq 0) { - 7z x "fnalibs.tar.bz2" + & "C:\Program Files\7-Zip\7z.exe" x "fnalibs.tar.bz2" if ($? -eq 1){ Remove-Item "fnalibs.tar.bz2"} else { Write-Output "ERROR: Unable to decompress successfully." exit } - 7z x "fnalibs.tar" -ofnalibs + & "C:\Program Files\7-Zip\7z.exe" x "fnalibs.tar" -ofnalibs if ($? -eq 1) { Remove-Item "fnalibs.tar" @@ -93,6 +89,70 @@ function getLibs () } +function checkMsbuild () +{ + try { msbuild | Out-Null } + catch [System.Management.Automation.CommandNotFoundException] + { + Write-Output "ERROR: 'msbuild' is not available. Attempting to look for build tools..." + if ((Test-Path "C:\Program Files (x86)\Microsoft Visual Studio") -eq 1) + { + $files = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\*" -Recurse -Include "msbuild.exe" | Where-Object { (Split-Path (Split-Path $_.FullName -Parent) -Leaf) -like 'bin'} + if ($files.Length -gt 0) + { + if ($files.Length -gt 1) + { + Write-Output "Found multiple build tools... unsure which version to use." + for ($i = 0; $i -lt $files.Length; $i++) + { + $filename = $files[$i].FullName + $c = $i + 1 + Write-Output "${c}: ${filename}" + } + $max = $files.Length + $choice = Read-Host -Prompt "Choose desired msbuild version? (1-${max})" + if ($choice -le 0 -or $choice -gt $files.Length+1) + { + "ERROR: invalid choice, exiting" + } + + $msbuildpath = Split-Path $files[$choice-1].FullName + Write-Output "your choice was ${choice} which equals this path: ${msbuildpath}. attempting to add to PATH..." + + [Environment]::SetEnvironmentVariable("Path", $env:Path + $msbuildpath, "Machine") + + Write-Output "Close and run getFNA.ps1 again..." + exit + + } + else + { + Write-Output "Found build tools, attempting to add to PATH..." + $msbuildpath = Split-Path $files[0].FullName + + [Environment]::SetEnvironmentVariable("Path", $env:Path + $msbuildpath, "Machine") + + Write-Output "Close and run getFNA.ps1 again..." + exit + } + } + else + { + Write-Output "ERROR: Build tools for Visual Studio not installed or installed in an unknown location." + Write-Output "If you know they are installed somewhere else, please create a PATH Environment Variable for them and retry." + exit + } + } + else + { + Write-Output "ERROR: Build tools for Visual Studio not installed or installed in an unknown location." + Write-Output "If you know they are installed somewhere else, please create a PATH Environment Variable for them and retry." + exit + } + } +} + +checkMsbuild if (Test-Path "${PSScriptRoot}\FNA") { diff --git a/getFNA.sh b/getFNA.sh new file mode 100644 index 0000000..9ba3ce4 --- /dev/null +++ b/getFNA.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# Program: getFNA +# Author: Caleb Cornett +# Usage: ./getFNA.sh +# Description: Quick and easy way to install a local copy of FNA and its native libraries. + +# Checks if dotnet is installed +function checkDotnet() +{ + # || { echo >&2 "ERROR: dotnet is not installed. Please install dotnet to download the t4 tool."; exit 1; } + command -v dotnet > /dev/null 2>&1 + if [ ! $? -eq 0 ]; then + echo >&2 "ERROR: dotnet is not installed. Please install dotnet to download the t4 tool." + exit 1 + fi +} + +# Checks if t4 is installed and installs it if it isnt +function installT4() +{ + checkDotnet + command -v t4 > /dev/null 2>&1 + if [ ! $? -eq 0 ]; then + dotnet tool install -g dotnet-t4 + fi +} + +# Checks if git is installed +function checkGit() +{ + git --version > /dev/null 2>&1 + if [ ! $? -eq 0 ]; then + echo >&2 "ERROR: Git is not installed. Please install git to download FNA." + exit 1 + fi +} + +# Clones FNA from the git master branch +function downloadFNA() +{ + checkGit + echo "Downloading FNA..." + git -C $MY_DIR clone https://github.com/FNA-XNA/FNA.git --recursive + if [ $? -eq 0 ]; then + echo "Finished downloading!" + else + echo >&2 "ERROR: Unable to download successfully. Maybe try again later?" + fi +} + +# Pulls FNA from the git master branch +function updateFNA() +{ + checkGit + echo "Updating to the latest git version of FNA..." + git -C "$MY_DIR/FNA" pull --recurse-submodules + if [ $? -eq 0 ]; then + echo "Finished updating!" + else + echo >&2 "ERROR: Unable to update." + exit 1 + fi +} + + +# Downloads and extracts prepackaged archive of native libraries ("fnalibs") +function getLibs() +{ + # Downloading + echo "Downloading latest fnalibs..." + curl http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 > "$MY_DIR/fnalibs.tar.bz2" + if [ $? -eq 0 ]; then + echo "Finished downloading!" + else + >&2 echo "ERROR: Unable to download successfully." + exit 1 + fi + + # Decompressing + echo "Decompressing fnalibs..." + mkdir -p $MY_DIR/fnalibs + tar xjC $MY_DIR/fnalibs -f $MY_DIR/fnalibs.tar.bz2 + if [ $? -eq 0 ]; then + echo "Finished decompressing!" + echo "" + rm $MY_DIR/fnalibs.tar.bz2 + else + >&2 echo "ERROR: Unable to decompress successfully." + exit 1 + fi +} + +# Get the directory of this script +MY_DIR=$(dirname "$BASH_SOURCE") + + +# gather input + +# FNA +if [ ! -d "$MY_DIR/FNA" ]; then + read -p "Download FNA (y/n)? " shouldDownload +else + read -p "Update FNA (y/n)? " shouldUpdate +fi + +if [ ! -d "$MY_DIR/fnalibs" ]; then + read -p "Download fnalibs (y/n)? " shouldDownloadLibs +else + read -p "Redownload fnalibs (y/n)? " shouldDownloadLibs +fi + + +# act on the input + +# FNA +if [[ $shouldDownload =~ ^[Yy]$ ]]; then + downloadFNA +elif [[ $shouldUpdate =~ ^[Yy]$ ]]; then + updateFNA +fi + +# FNALIBS +if [[ $shouldDownloadLibs =~ ^[Yy]$ ]]; then + getLibs +fi + + +# install t4 engine +installT4 + + + +# Only proceed from here if we have not yet renamed the project +if [ ! -d "$MY_DIR/project_name" ]; then + # old project_name folder already renamed so we are all done here + exit 1 +fi + + +read -p "Enter the project name to use for your folder and csproj file or 'exit' to quit: " newProjectName +if [[ $newProjectName = 'exit' || -z "$newProjectName" ]]; then + exit 1 +fi + +# any files that need to have project_name replaced with the new project name should be here +files=(project_name.sln .gitignore project_name/project_name.csproj project_name/Game1.cs project_name/DemoComponent.cs project_name/DefaultScene.cs project_name/Program.cs .vscode/tasks.json .vscode/settings.json .vscode/launch.json .vscode/buildEffects.sh .vscode/processT4Templates.sh) +for file in "${files[@]}"; do + sed -i '' "s/project_name/$newProjectName/g" $file +done + +mv project_name.sln "$newProjectName.sln" +mv project_name/project_name.sln "project_name/$newProjectName.sln" +mv project_name/project_name.csproj "project_name/$newProjectName.csproj" +mv project_name/project_name.csproj.user "project_name/$newProjectName.csproj.user" +mv project_name "$newProjectName" + +git init +git submodule add https://github.com/prime31/Nez.git +cd Nez +git submodule init +git submodule update + +command -v pbcopy > /dev/null 2>&1 +if [ ! $? -eq 0 ]; then + printf "\n\nManually run the following command:\n\nnuget restore Nez/Nez.sln && msbuild Nez/Nez.sln && msbuild /t:restore $newProjectName && msbuild $newProjectName.sln\n\n" +else + echo "nuget restore Nez/Nez.sln && msbuild Nez/Nez.sln && msbuild /t:restore $newProjectName && msbuild $newProjectName.sln" | pbcopy + echo "" + echo "A build command was copied to your clipboard. Paste and run it now." + echo "" +fi diff --git a/project_name.sln b/project_name.sln index c956a2f..7720695 100644 --- a/project_name.sln +++ b/project_name.sln @@ -24,8 +24,19 @@ Global {16DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Debug|Any CPU.Build.0 = Debug|Any CPU {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CB9E917-FEF7-453F-A88D-6B85B552B058}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CB9E917-FEF7-453F-A88D-6B85B552B058}.Release|Any CPU.Build.0 = Release|Any CPU + {35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|Any CPU.Build.0 = Release|Any CPU + {11A5855C-B12C-4F8D-B935-56F3D0B671C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11A5855C-B12C-4F8D-B935-56F3D0B671C3}.Release|Any CPU.Build.0 = Release|Any CPU + {16DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.Build.0 = Release|Any CPU + {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26DA6D66-4DFD-46D4-A367-C02B48B80CAA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file diff --git a/project_name/DemoComponent.cs b/project_name/DemoComponent.cs index cceb7c0..1618b49 100644 --- a/project_name/DemoComponent.cs +++ b/project_name/DemoComponent.cs @@ -2,7 +2,7 @@ using ImGuiNET; using Nez; using Nez.ImGuiTools; -namespace project_name +namespace lucid { public class DemoComponent : Component { @@ -11,24 +11,29 @@ namespace project_name public override void onAddedToEntity() { // register with the ImGuiMangaer letting it know we want to render some IMGUI +#if DEBUG Core.getGlobalManager().registerDrawCommand(imGuiDraw); +#endif } public override void onRemovedFromEntity() { // remove ourselves when we are removed from the Scene +#if DEBUG Core.getGlobalManager().unregisterDrawCommand(imGuiDraw); +#endif } void imGuiDraw() { // do your actual drawing here - ImGui.Begin("Your ImGui Window", ImGuiWindowFlags.AlwaysAutoResize); + ImGui.Begin("Your ImGui Window", ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text("This is being drawn in DemoComponent"); - if(ImGui.Button($"Clicked me {_buttonClickCounter} times")) + if (ImGui.Button($"Clicked me {_buttonClickCounter} times")) _buttonClickCounter++; ImGui.End(); } } } + diff --git a/project_name/Game1.cs b/project_name/Game1.cs index 37a9350..08f0cb5 100644 --- a/project_name/Game1.cs +++ b/project_name/Game1.cs @@ -14,13 +14,15 @@ namespace project_name #if DEBUG System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(System.Console.Out)); + + // render Nez in the imgui window in debug mode + var imGuiManager = new ImGuiManager(); + Core.registerGlobalManager(imGuiManager); #endif scene = new DefaultScene(); - // optionally render Nez in an ImGui window - var imGuiManager = new ImGuiManager(); - Core.registerGlobalManager(imGuiManager); + } } } \ No newline at end of file diff --git a/project_name/project_name.csproj b/project_name/project_name.csproj index e6bd126..b384478 100644 --- a/project_name/project_name.csproj +++ b/project_name/project_name.csproj @@ -8,6 +8,7 @@ project_name DesktopGL True + false From 2c926361e4f739f65abe1a1437c4b3fa59baca79 Mon Sep 17 00:00:00 2001 From: foxnne Date: Mon, 2 Sep 2019 22:07:14 -0500 Subject: [PATCH 03/10] Update DemoComponent.cs Accidentally left in a testing name... --- project_name/DemoComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project_name/DemoComponent.cs b/project_name/DemoComponent.cs index 1618b49..f05cd24 100644 --- a/project_name/DemoComponent.cs +++ b/project_name/DemoComponent.cs @@ -2,7 +2,7 @@ using ImGuiNET; using Nez; using Nez.ImGuiTools; -namespace lucid +namespace project_name { public class DemoComponent : Component { From 7af4093e6762136987aaf06118b83374f00bc545 Mon Sep 17 00:00:00 2001 From: foxnne Date: Wed, 4 Sep 2019 01:14:21 -0500 Subject: [PATCH 04/10] Fixed some issues with the powershell scripts inside of .vscode I had only tested the other configuration on a single project and in practice saw that the current vscode terminal location would cause a fail if it was in use. Now the build task uses a reference location... Also fixed a few of the build tasks which seemed to work before, but werent calling anymore for some reason using the & modifier. Now thye seem to always work using the powershell command to open the ps1 files. --- .vscode/buildEffects.ps1 | 3 +++ .vscode/processT4Templates.ps1 | 8 +++++--- .vscode/tasks.json | 14 +++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.vscode/buildEffects.ps1 b/.vscode/buildEffects.ps1 index 0f5a719..a6ed69b 100644 --- a/.vscode/buildEffects.ps1 +++ b/.vscode/buildEffects.ps1 @@ -6,8 +6,10 @@ Write-Output "Starting build process..." +Set-Location $PSScriptRoot Set-Location ../project_name + $fxc = "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe" $files = Get-ChildItem -Path "Content\*" -Recurse -Include *fx @@ -21,3 +23,4 @@ foreach ($file in $files) Write-Output "Built ${fileName}.fx to ${filePath}b" } + diff --git a/.vscode/processT4Templates.ps1 b/.vscode/processT4Templates.ps1 index b70f07a..974975a 100644 --- a/.vscode/processT4Templates.ps1 +++ b/.vscode/processT4Templates.ps1 @@ -6,11 +6,11 @@ Write-Output "Starting T4 processing..." -Set-Location ../project_name +Set-Location $PSScriptRoot +Set-Location ..\project_name # create our output directory -if ((Test-Path("T4Templates")) -eq 0) { New-Item -ItemType "directory" -Path "T4Templates" } -if ((Test-Path("T4Templates\Output")) -eq 0) { New-Item -ItemType "directory" -Path "T4Templates\Output"} +if ((Test-Path("T4Templates\Output")) -eq 0) { New-Item -ItemType "directory" -Path "T4Templates\Output" } $files = Get-ChildItem ".\T4Templates\*" -Include *.tt @@ -19,7 +19,9 @@ foreach ($file in $files) $fileName = $file.BaseName # Build the template t4 -r System.dll -r mscorlib.dll -r netstandard.dll -r System.IO.FileSystem.dll -r System.Linq.dll -r System.Text.RegularExpressions -o "T4Templates\Output\${fileName}.cs" "T4Templates\${fileName}.tt" + Write-Output "Built ${fileName}.cs from ${fileName}.tt" } + diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 851db23..fdacfa0 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -112,7 +112,11 @@ "command": "${workspaceFolder}/.vscode/buildEffects.sh" }, "windows":{ - "command": "& ${workspaceFolder}/.vscode/buildEffects.ps1" + "command": "powershell", + "args": [ + "-File", + "${workspaceFolder}/.vscode/buildEffects.ps1" + ], }, "problemMatcher": "$msCompile" }, @@ -168,10 +172,14 @@ "command": "${workspaceFolder}/.vscode/processT4Templates.sh" }, "windows": { - "command": "& ${workspaceFolder}/.vscode/processT4Templates.ps1" + "command": "powershell", + "args": [ + "-File", + "${workspaceFolder}/.vscode/processT4Templates.ps1" + ] }, "group": "build", "problemMatcher": "$msCompile", }, ] -} \ No newline at end of file +} From 64673dbf49b7fc31346c3362e1af1d0e4e690762 Mon Sep 17 00:00:00 2001 From: foxnne Date: Sat, 7 Sep 2019 17:12:24 -0500 Subject: [PATCH 05/10] Removed PATH setting for msbuild and updated for PascalCase. --- getFNA.ps1 | 103 +++++++++------------------------- project_name/DefaultScene.cs | 22 ++++---- project_name/DemoComponent.cs | 16 +++--- project_name/Game1.cs | 6 +- 4 files changed, 46 insertions(+), 101 deletions(-) diff --git a/getFNA.ps1 b/getFNA.ps1 index cb8288f..162c762 100644 --- a/getFNA.ps1 +++ b/getFNA.ps1 @@ -7,15 +7,30 @@ # Checks if dotnet is installed function checkDotnet() { - try - { - dotnet | Out-Null - return 1 - } + try { dotnet | Out-Null } catch [System.Management.Automation.CommandNotFoundException] { Write-Output "ERROR: Dotnet is not installed. Please install dotnet to download the t4 tool." - return 0 + exit + } +} + +function checkMsbuild () +{ + try { msbuild | Out-Null } + catch [System.Management.Automation.CommandNotFoundException] + { + Write-Output "ERROR: Msbuild is not available, please ensure msbuild.exe is installed and added to the PATH Environment Variable." + exit + } +} + +function check7zip () +{ + if ((Test-Path "C:\Program Files\7-Zip") -eq 0) + { + Write-Output "ERROR: 7zip is not installed, please install 7zip and try again." + exit } } @@ -55,14 +70,7 @@ function updateFNA () else { Write-Output "ERROR: Unable to update." exit} } -function check7zip () -{ - if ((Test-Path "C:\Program Files\7-Zip") -eq 0) - { - Write-Output "ERROR: 7zip is not installed, please install 7zip and try again." - exit - } -} + function getLibs () { @@ -89,69 +97,6 @@ function getLibs () } -function checkMsbuild () -{ - try { msbuild | Out-Null } - catch [System.Management.Automation.CommandNotFoundException] - { - Write-Output "ERROR: 'msbuild' is not available. Attempting to look for build tools..." - if ((Test-Path "C:\Program Files (x86)\Microsoft Visual Studio") -eq 1) - { - $files = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\*" -Recurse -Include "msbuild.exe" | Where-Object { (Split-Path (Split-Path $_.FullName -Parent) -Leaf) -like 'bin'} - if ($files.Length -gt 0) - { - if ($files.Length -gt 1) - { - Write-Output "Found multiple build tools... unsure which version to use." - for ($i = 0; $i -lt $files.Length; $i++) - { - $filename = $files[$i].FullName - $c = $i + 1 - Write-Output "${c}: ${filename}" - } - $max = $files.Length - $choice = Read-Host -Prompt "Choose desired msbuild version? (1-${max})" - if ($choice -le 0 -or $choice -gt $files.Length+1) - { - "ERROR: invalid choice, exiting" - } - - $msbuildpath = Split-Path $files[$choice-1].FullName - Write-Output "your choice was ${choice} which equals this path: ${msbuildpath}. attempting to add to PATH..." - - [Environment]::SetEnvironmentVariable("Path", $env:Path + $msbuildpath, "Machine") - - Write-Output "Close and run getFNA.ps1 again..." - exit - - } - else - { - Write-Output "Found build tools, attempting to add to PATH..." - $msbuildpath = Split-Path $files[0].FullName - - [Environment]::SetEnvironmentVariable("Path", $env:Path + $msbuildpath, "Machine") - - Write-Output "Close and run getFNA.ps1 again..." - exit - } - } - else - { - Write-Output "ERROR: Build tools for Visual Studio not installed or installed in an unknown location." - Write-Output "If you know they are installed somewhere else, please create a PATH Environment Variable for them and retry." - exit - } - } - else - { - Write-Output "ERROR: Build tools for Visual Studio not installed or installed in an unknown location." - Write-Output "If you know they are installed somewhere else, please create a PATH Environment Variable for them and retry." - exit - } - } -} - checkMsbuild if (Test-Path "${PSScriptRoot}\FNA") @@ -225,9 +170,11 @@ Set-Location Nez git submodule init git submodule update -"Restoring and rebuilding..." +"Restoring..." Set-Location $PSScriptRoot dotnet restore "Nez/Nez.sln" + +"Building..." msbuild "Nez/Nez.sln" msbuild -t:restore $newProjectName msbuild -t:buildcontent $newProjectName diff --git a/project_name/DefaultScene.cs b/project_name/DefaultScene.cs index 3e19a9c..e51a862 100644 --- a/project_name/DefaultScene.cs +++ b/project_name/DefaultScene.cs @@ -7,21 +7,21 @@ namespace project_name { public class DefaultScene : Scene { - public override void initialize() + public override void Initialize() { - setDesignResolution(Screen.width, Screen.height, Scene.SceneResolutionPolicy.None); + SetDesignResolution(Screen.Width, Screen.Height, Scene.SceneResolutionPolicy.None); - addRenderer(new DefaultRenderer()); + AddRenderer(new DefaultRenderer()); - createEntity("demo imgui draw commands") - .setPosition(new Vector2(150, 150)) - .addComponent() - .addComponent(new PrototypeSprite(20, 20)); + CreateEntity("demo imgui draw commands") + .SetPosition(new Vector2(150, 150)) + .AddComponent() + .AddComponent(new PrototypeSprite(20, 20)); - var logo = content.Load("nez-logo-black"); - createEntity("logo") - .setPosition(Screen.center) - .addComponent(new Nez.Sprites.Sprite(logo)); + var Logo = Content.Load("nez-logo-black"); + CreateEntity("logo") + .SetPosition(Screen.center) + .AddComponent(new Nez.Sprites.Sprite(Logo)); } } } diff --git a/project_name/DemoComponent.cs b/project_name/DemoComponent.cs index f05cd24..6e8597f 100644 --- a/project_name/DemoComponent.cs +++ b/project_name/DemoComponent.cs @@ -6,31 +6,31 @@ namespace project_name { public class DemoComponent : Component { - int _buttonClickCounter; + int _ButtonClickCounter; - public override void onAddedToEntity() + public override void OnAddedToEntity() { // register with the ImGuiMangaer letting it know we want to render some IMGUI #if DEBUG - Core.getGlobalManager().registerDrawCommand(imGuiDraw); + Core.GetGlobalManager().RegisterDrawCommand(ImGuiDraw); #endif } - public override void onRemovedFromEntity() + public override void OnRemovedFromEntity() { // remove ourselves when we are removed from the Scene #if DEBUG - Core.getGlobalManager().unregisterDrawCommand(imGuiDraw); + Core.GetGlobalManager().UnregisterDrawCommand(ImGuiDraw); #endif } - void imGuiDraw() + void ImGuiDraw() { // do your actual drawing here ImGui.Begin("Your ImGui Window", ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text("This is being drawn in DemoComponent"); - if (ImGui.Button($"Clicked me {_buttonClickCounter} times")) - _buttonClickCounter++; + if (ImGui.Button($"Clicked me {_ButtonClickCounter} times")) + _ButtonClickCounter++; ImGui.End(); } diff --git a/project_name/Game1.cs b/project_name/Game1.cs index 08f0cb5..da5c50c 100644 --- a/project_name/Game1.cs +++ b/project_name/Game1.cs @@ -17,12 +17,10 @@ namespace project_name // render Nez in the imgui window in debug mode var imGuiManager = new ImGuiManager(); - Core.registerGlobalManager(imGuiManager); + Core.RegisterGlobalManager(imGuiManager); #endif - scene = new DefaultScene(); - - + Scene = new DefaultScene(); } } } \ No newline at end of file From 4f8a7af367167c7b264e0fe81ff6c4e7964993bc Mon Sep 17 00:00:00 2001 From: foxnne Date: Sat, 7 Sep 2019 20:46:43 -0500 Subject: [PATCH 06/10] Updated DefaultScene.cs Hopefully now have all the camelCases covered... --- project_name/DefaultScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project_name/DefaultScene.cs b/project_name/DefaultScene.cs index e51a862..574bdd1 100644 --- a/project_name/DefaultScene.cs +++ b/project_name/DefaultScene.cs @@ -20,7 +20,7 @@ namespace project_name var Logo = Content.Load("nez-logo-black"); CreateEntity("logo") - .SetPosition(Screen.center) + .SetPosition(Screen.Center) .AddComponent(new Nez.Sprites.Sprite(Logo)); } } From d36e9c03b2e52916ed2db70d4d5e3006ea09a15f Mon Sep 17 00:00:00 2001 From: foxnne Date: Thu, 12 Sep 2019 11:54:44 -0500 Subject: [PATCH 07/10] Update ContentPathGenerator.tt (PascalCase) --- .../T4Templates/ContentPathGenerator.tt | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/project_name/T4Templates/ContentPathGenerator.tt b/project_name/T4Templates/ContentPathGenerator.tt index 9483dc2..af59be3 100644 --- a/project_name/T4Templates/ContentPathGenerator.tt +++ b/project_name/T4Templates/ContentPathGenerator.tt @@ -23,7 +23,7 @@ namespace Nez WriteLine( $"\t\t// folder: {sourceFolder}" ); // handle any files in the root sourceFolder - printContentFiles( sourceFolder, 2, sourceFolder ); + PrintContentFiles( sourceFolder, 2, sourceFolder ); // loop through all the directories in our sourceFolder var directories = Directory.GetDirectories( sourceFolder ); @@ -34,11 +34,11 @@ namespace Nez continue; // dont delve into directories that don't contan xnb files if this is the CompiledContent folder - if( !shouldTraverseSubfolders( dir ) ) + if( !ShouldTraverseSubfolders( dir ) ) continue; // start off the recursive directory printing - printDirectoryClass( dir, 2, sourceFolder ); + PrintDirectoryClass( dir, 2, sourceFolder ); } } #> @@ -61,7 +61,7 @@ namespace Nez "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while" }; - bool shouldTraverseSubfolders( string path ) + bool ShouldTraverseSubfolders( string path ) { if( !path.Contains( "/bin/" ) ) { @@ -72,26 +72,26 @@ namespace Nez } // recursively creates a class for each directory - void printDirectoryClass( string dir, int depth, string sourceFolder ) + void PrintDirectoryClass( string dir, int depth, string sourceFolder ) { var dirInfo = new DirectoryInfo( dir ); var firstIndent = new string( ' ', depth * 4 ); - var className = generateClassName( dirInfo.Name, true ); + var className = GenerateClassName( dirInfo.Name ); WriteLine( "{0}public static class {1}\n{2}{{", firstIndent, className, firstIndent ); // handle subdirectories foreach( var subdir in Directory.GetDirectories( dir ) ) - printDirectoryClass( subdir, depth + 1, sourceFolder ); + PrintDirectoryClass( subdir, depth + 1, sourceFolder ); // handle files - printContentFiles( dir, depth + 1, sourceFolder ); + PrintContentFiles( dir, depth + 1, sourceFolder ); WriteLine( "{0}}}\n", firstIndent ); } // prints a const string for each file in the directory - void printContentFiles( string dir, int depth, string sourceFolder ) + void PrintContentFiles( string dir, int depth, string sourceFolder ) { var firstIndent = new string( ' ', depth * 4 ); @@ -110,7 +110,7 @@ namespace Nez fileName = fileName.Replace( extension, string.Empty ); } - var className = generateClassName( fileName, false ); + var className = GenerateClassName( fileName ); if( finalPath[0] == '/' || finalPath[0] == '\\' ) finalPath = finalPath.Substring( 1 ); @@ -129,14 +129,14 @@ namespace Nez } - string stripInvalidPathChars( string input ) + string StripInvalidPathChars( string input ) { var invalidChars = Path.GetInvalidPathChars(); return new string( input.Where( m => !invalidChars.Contains( m ) ).ToArray() ); } - string stripInvalidFilenameChars( string input ) + string StripInvalidFilenameChars( string input ) { var invalidChars = Path.GetInvalidFileNameChars(); return new string( input.Where( m => !invalidChars.Contains( m ) ).ToArray() ); @@ -144,13 +144,9 @@ namespace Nez // attempts to generate a proper path name - string generateClassName( string className, bool uppercaseFirstChar ) + string GenerateClassName( string className ) { - // handle upper or lower casing the first char in the className - if( uppercaseFirstChar && char.IsLower( className[0] ) ) - className = char.ToUpper( className[0] ) + className.Substring( 1 ); - else if( !uppercaseFirstChar && char.IsUpper( className[0] ) ) - className = char.ToLower( className[0] ) + className.Substring( 1 ); + className = char.ToUpper( className[0] ) + className.Substring( 1 ); // remove invalid characters var regex = new Regex( @"[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Nl}\p{Mn}\p{Mc}\p{Cf}\p{Pc}\p{Lm}]" ); From a63ff0184bec7f065b7f26f55fdbe8ca33782a4a Mon Sep 17 00:00:00 2001 From: foxnne Date: Sat, 21 Sep 2019 17:01:18 -0500 Subject: [PATCH 08/10] Remove mgcb and shift default texture to new path --- project_name/CompiledContent/Content.mgcb | 29 ------------------ .../Textures}/nez-logo-black.png | Bin 2 files changed, 29 deletions(-) delete mode 100644 project_name/CompiledContent/Content.mgcb rename project_name/{CompiledContent => Content/Textures}/nez-logo-black.png (100%) diff --git a/project_name/CompiledContent/Content.mgcb b/project_name/CompiledContent/Content.mgcb deleted file mode 100644 index 45c48e4..0000000 --- a/project_name/CompiledContent/Content.mgcb +++ /dev/null @@ -1,29 +0,0 @@ - -#----------------------------- 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 \ No newline at end of file diff --git a/project_name/CompiledContent/nez-logo-black.png b/project_name/Content/Textures/nez-logo-black.png similarity index 100% rename from project_name/CompiledContent/nez-logo-black.png rename to project_name/Content/Textures/nez-logo-black.png From 5920d62e4d8fe0fc8cf5eff102b8216ab826b089 Mon Sep 17 00:00:00 2001 From: foxnne Date: Sat, 21 Sep 2019 20:12:30 -0500 Subject: [PATCH 09/10] hopefully fixed content builder errors --- .vscode/tasks.json | 48 ++++++++++++++++++++++- MonoGameContent.targets | 16 ++++---- getFNA.ps1 | 35 +++++++---------- project_name/CompiledContent/Content.mgcb | 29 ++++++++++++++ project_name/DefaultScene.cs | 2 +- project_name/project_name.csproj | 19 +++++++++ 6 files changed, 120 insertions(+), 29 deletions(-) create mode 100644 project_name/CompiledContent/Content.mgcb diff --git a/.vscode/tasks.json b/.vscode/tasks.json index dd1d1d2..693003f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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", diff --git a/MonoGameContent.targets b/MonoGameContent.targets index c5acfa8..5437823 100644 --- a/MonoGameContent.targets +++ b/MonoGameContent.targets @@ -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 $(MSBuildProgramFiles32) + $(MonoGameInstallDir)Tools\MGCB.exe bin/DesktopGL obj/DesktopGL @@ -38,7 +40,7 @@ /usr/local/bin/mono /usr/bin/mono mono - $(MonoGameInstallDir)Tools\MGCB.exe + "$(MonoGameContentBuilderExe)" $(MonoExe) $(MonoGameContentBuilderCmd) $(MonoMacResourcePrefix) @@ -50,17 +52,17 @@
/platform:$(MonoGamePlatform)
+ + - - - diff --git a/getFNA.ps1 b/getFNA.ps1 index 162c762..bdd43bb 100644 --- a/getFNA.ps1 +++ b/getFNA.ps1 @@ -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" diff --git a/project_name/CompiledContent/Content.mgcb b/project_name/CompiledContent/Content.mgcb new file mode 100644 index 0000000..45c48e4 --- /dev/null +++ b/project_name/CompiledContent/Content.mgcb @@ -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 \ No newline at end of file diff --git a/project_name/DefaultScene.cs b/project_name/DefaultScene.cs index 2e1f3e1..3c5efa0 100644 --- a/project_name/DefaultScene.cs +++ b/project_name/DefaultScene.cs @@ -16,7 +16,7 @@ namespace project_name .AddComponent() .AddComponent(new PrototypeSprite(20, 20)); - var logo = Content.Load("nez-logo-black"); + var logo = Content.LoadTexture("Textures/nez-logo-black"); CreateEntity("logo") .SetPosition(Screen.Center) .AddComponent(new SpriteRenderer(logo)); diff --git a/project_name/project_name.csproj b/project_name/project_name.csproj index 8354c78..a797bdc 100644 --- a/project_name/project_name.csproj +++ b/project_name/project_name.csproj @@ -38,6 +38,25 @@ PreserveNewest
+ + + + + Content/%(RecursiveDir)%(Filename)%(Extension) + PreserveNewest + + + + + + + + + + + + + true From 38d7b66ac3ea8f1436cfaad6202306a9991673bd Mon Sep 17 00:00:00 2001 From: foxnne Date: Sat, 21 Sep 2019 20:44:36 -0500 Subject: [PATCH 10/10] should fix exiting without dotnet --- getFNA.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/getFNA.ps1 b/getFNA.ps1 index bdd43bb..2dfcddd 100644 --- a/getFNA.ps1 +++ b/getFNA.ps1 @@ -11,8 +11,9 @@ function checkDotnet() catch [System.Management.Automation.CommandNotFoundException] { Write-Output "ERROR: Dotnet is not installed. Please install dotnet to download the t4 tool." - exit + return 0; } + return 1; } function installT4 ()