From 7af4093e6762136987aaf06118b83374f00bc545 Mon Sep 17 00:00:00 2001 From: foxnne Date: Wed, 4 Sep 2019 01:14:21 -0500 Subject: [PATCH] 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 +}