Make compatible with macOS and VS Code Insiders
This commit is contained in:
Родитель
74aad31e05
Коммит
906f5eec5a
|
@ -3,6 +3,9 @@
|
|||
|
||||
For easy building and testing you can use the `build.ps1` script. This script is only for manual use and not part of any pipeline.
|
||||
|
||||
> [!NOTE]
|
||||
> On macOS you find encounter and error like: `error NU5119: Warning As Error: File '/file/path/.DS_Store' was not added to the package. Files and folders starting with '.' or ending with '.nupkg' are excluded by default. To include this file, use -NoDefaultExcludes from the commandline` when this happens, run a `git clean -xfd` on the repository to remove all `.DS_Store` files from the filesystem.
|
||||
|
||||
## Functionality
|
||||
|
||||
The script:
|
||||
|
|
|
@ -39,20 +39,30 @@ Empty-UserHomeTemplateEngineFolder
|
|||
dotnet new install $nupkgPath.FullName
|
||||
|
||||
# Create a new dotnet project using the specified project type
|
||||
dotnet new $projectType -o .tempTemplateOutput\NewProject --force
|
||||
dotnet new $projectType -o ./.tempTemplateOutput/NewProject --force
|
||||
|
||||
if ($startVsAfterBuild -eq $false) {
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Start Visual Studio with the newly created project
|
||||
$projectFilePath = Resolve-Path ".\.tempTemplateOutput\NewProject\NewProject.csproj"
|
||||
$projectFilePath = Resolve-Path "./.tempTemplateOutput/NewProject/NewProject.csproj"
|
||||
$projectFolderPath = Split-Path -Path $projectFilePath
|
||||
|
||||
if ([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)) {
|
||||
Start-Process "devenv.exe" -ArgumentList $projectFilePath
|
||||
} elseif ([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::OSX)) {
|
||||
Start-Process "code" -ArgumentList $projectFolderPath
|
||||
# Check if VS Code Insiders is installed
|
||||
$vscodeInsidersPath = "/Applications/Visual Studio Code - Insiders.app"
|
||||
$vscodeStablePath = "/Applications/Visual Studio Code.app"
|
||||
|
||||
if (Test-Path $vscodeInsidersPath) {
|
||||
Start-Process "code-insiders" -ArgumentList $projectFolderPath
|
||||
} elseif (Test-Path $vscodeStablePath) {
|
||||
Start-Process "code" -ArgumentList $projectFolderPath
|
||||
} else {
|
||||
Write-Error "Neither Visual Studio Code Insiders nor Visual Studio Code stable is installed. Cannot open VS Code, however a new project is created at $projectFolderPath."
|
||||
}
|
||||
} else {
|
||||
Write-Error "Unsupported operating system."
|
||||
}
|
Загрузка…
Ссылка в новой задаче