kuiperzone / PupNet-HelloWorld

A Hello World demonstration for PupNet Deploy cross-platform utility for .NET
GNU Affero General Public License v3.0
3 stars 0 forks source link

Error when deploying under windows if the folder path contains spaces. #3

Open yurygolub opened 1 year ago

yurygolub commented 1 year ago

I'm trying to build windows setup, but I'm getting an error. Looks like spaces in the path to PostPublish.bat cause it.

d:\Path to folder\PupNet-HelloWorld>dotnet tool run pupnet --kind setup
PupNet Deploy 1.5.0
Configuration: HelloWorld.pupnet.conf

============================================================
APPLICATION: HelloWorld 1.0.3 [1]
============================================================

AppBaseName: HelloWorld
AppId: zone.kuiper.helloworld
AppVersion: 1.0.3
PackageRelease: 1
StartCommand: helloworld
SetupCommandPrompt: Command Prompt

============================================================
OUTPUT: SETUP
============================================================

PackageKind: Setup
Runtime: win-x64
Arch: Auto (x64)
Build: Release
OutputName: HelloWorld.x64.exe
OutputDirectory: d:\Path to folder\PupNet-HelloWorld\Deploy/bin

============================================================
BUILD PROJECT: PupNet-HelloWorld
============================================================

dotnet publish "d:\Path to folder\PupNet-HelloWorld" -r win-x64 -c Release -p:Version=1.0.3 --self-contained true -p:DebugType=None -p:DebugSymbols=false -o "C:\Users\User\AppData\Local\Temp\KuiperZone.PupNet\zone.kuiper.helloworld-win-x64-Release-Setup\AppDir\Publish"

d:\Path to folder\PupNet-HelloWorld\Deploy/PostPublish.bat

============================================================
BUILD PACKAGE: HelloWorld.x64.exe
============================================================

iscc /O"d:\Path to folder\PupNet-HelloWorld\Deploy/bin" "C:\Users\User\AppData\Local\Temp\KuiperZone.PupNet\zone.kuiper.helloworld-win-x64-Release-Setup\HelloWorld.iss"

============================================================
ISSUES
============================================================

NONE

Continue? [N/y]: Y
Remove: . ... OK
Create Directory: . ... OK
Create Directory: AppDir ... OK
Create Directory: AppDir\Publish ... OK
Create File: AppDir\Publish\helloworld.bat ... OK
Create File: AppDir\Publish\CommandPrompt.bat ... OK

Building Project ...
cmd /C dotnet publish "d:\Path to folder\PupNet-HelloWorld" -r win-x64 -c Release -p:Version=1.0.3 --self-contained true -p:DebugType=None -p:DebugSymbols=false -o "C:\Users\User\AppData\Local\Temp\KuiperZone.PupNet\zone.kuiper.helloworld-win-x64-Release-Setup\AppDir\Publish"
MSBuild version 17.6.1+8ffc3fe3d for .NET
  Determining projects to restore...
  Restored d:\Path to folder\PupNet-HelloWorld\HelloWorld\HelloWorld.csproj (in 83 ms).
C:\Program Files\dotnet\sdk\7.0.302\Current\SolutionFile\ImportAfter\Microsoft.NET.Sdk.Solution.targets(36,5): warning NETSDK1194: The "--output" option isn't supported when building a solution. Specifying a solution-level output path results in all projects copying outputs to the same directory, which can lead to inconsistent builds. [d:\Path to folder\PupNet-HelloWorld\HelloWorld.sln]
  HelloWorld -> d:\Path to folder\PupNet-HelloWorld\HelloWorld\bin\Release\net6.0\win-x64\HelloWorld.dll
  HelloWorld -> C:\Users\User\AppData\Local\Temp\KuiperZone.PupNet\zone.kuiper.helloworld-win-x64-Release-Setup\AppDir\Publish\

cmd /C d:\Path to folder\PupNet-HelloWorld\Deploy/PostPublish.bat
'd:\Path' is not recognized as an internal or external command,
operable program or batch file.

FAILED
cmd returned non-zero exit code 1
kuiperzone commented 1 year ago

Yes, it looks like you are correct. Will take a look. Thank you

kuiperzone commented 1 year ago

I have a taken a look at this. This is not a bug.

cmd /C d:\Path to folder\PupNet-HelloWorld\Deploy/PostPublish.bat

The solution is simply to put quotes around the DotnetPostPublish or DotnetPostPublishOnWindows values in your config file. The values are not necessarily simple script filenames, but may theoretically contain commands, hence why I did not ensure they were quoted prior to be called.