GitTools / GitVersion

From git log to SemVer in no time
https://gitversion.net/docs/
MIT License
2.87k stars 654 forks source link

[Bug] C:\Users\Nutzer\.nuget\packages\gitversion.msbuild\5.6.4\tools\net48/gitversion.exe "C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\src\PagerDutyClient" -output file -outputfile obj\gitversion.json" ended with code 1. #2555

Closed SeppPenner closed 3 years ago

SeppPenner commented 3 years ago

Describe the bug It seems like there is still some issue when there are empty spaces in the path names. This is most likely related to https://github.com/GitTools/GitVersion/issues/2540 and https://github.com/GitTools/GitVersion/issues/2534.

Der Befehl "C:\Users\Nutzer\.nuget\packages\gitversion.msbuild\5.6.4\tools\net48/gitversion.exe "C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\src\PagerDutyClient" -output file -outputfile obj\gitversion.json" wurde mit dem Code 1 beendet.

Expected Behavior

Build in Visual Studio should work.

Actual Behavior

When I run the command from the console, it tells me:

Microsoft Windows [Version 10.0.19041.746]
(c) 2020 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\Nutzer>C:\Users\Nutzer\.nuget\packages\gitversion.msbuild\5.6.4\tools\net48/gitversion.exe "C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\src\PagerDutyClient" -output file -outputfile obj\gitversion.json"
INFO [01/20/21 19:50:41:97] Working directory: C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\src\PagerDutyClient
INFO [01/20/21 19:50:42:00] Project root is: C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\
INFO [01/20/21 19:50:42:00] DotGit directory is: C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\.git
INFO [01/20/21 19:50:42:02] Begin: Loading version variables from disk cache
  INFO [01/20/21 19:50:42:02] Begin: Deserializing version variables from cache file C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\.git\gitversion_cache\61AF06B74CA3A5E0577CC2EF563E08D9902FED79.yml
  INFO [01/20/21 19:50:42:07] End: Deserializing version variables from cache file C:\Users\Nutzer\Documents\Temp\Github\C# und VB\PagerDutyClient\.git\gitversion_cache\61AF06B74CA3A5E0577CC2EF563E08D9902FED79.yml (Took: 52.50ms)
  INFO [01/20/21 19:50:42:07] End: Loading version variables from disk cache (Took: 53.00ms)
  ERROR [01/20/21 19:50:42:16] An unexpected error occurred:
System.IO.DirectoryNotFoundException: Ein Teil des Pfades "C:\Users\Nutzer\obj\gitversion.json" konnte nicht gefunden werden.
   bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   bei System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   bei System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   bei System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   bei System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   bei System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
   bei GitVersion.FileSystem.WriteAllText(String file, String fileContents) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Core\FileSystem.cs:Zeile 42.
   bei GitVersion.VersionConverters.OutputGenerator.OutputGenerator.Execute(VersionVariables variables, OutputContext context) in D:\a\GitVersion\GitVersion\src\GitVersionCore\VersionConverters\OutputGenerator\OutputGenerator.cs:Zeile 39.
   bei GitVersion.GitVersionOutputTool.OutputVariables(VersionVariables variables, Boolean updateBuildNumber) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Core\GitVersionOutputTool.cs:Zeile 42.
   bei GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersionExe\GitVersionExecutor.cs:Zeile 66.
  INFO [01/20/21 19:50:42:16] Attempting to show the current git graph (please include in issue):
  INFO [01/20/21 19:50:42:16] Showing max of 100 commits
  INFO [01/20/21 19:50:42:20] * 68af730 4 minutes ago  (HEAD -> master)

Possible Fix

Seems to be an issue with the path \obj\gitversion.json which somehow is combined to C:\Users\Nutzer\obj\gitversion.json.

Steps to Reproduce

Check out https://github.com/SeppPenner/PagerDutyClient and compile it from a root path that contains empty spaces.

Context

None.

Your Environment

dotnet --info

.NET SDK (gemäß "global.json"):
 Version:   5.0.102
 Commit:    71365b4d42

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.102\

Host (useful for support):
  Version: 5.0.2
  Commit:  cb5f173b96

.NET SDKs installed:
  2.1.806 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.202 [C:\Program Files\dotnet\sdk]
  3.1.300 [C:\Program Files\dotnet\sdk]
  3.1.402 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]
  5.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
SeppPenner commented 3 years ago

Maybe it has something to do with multiple target frameworks? I can build all my other projects if they have only one target framework specified...

SeppPenner commented 3 years ago

Nice :)

SeppPenner commented 3 years ago

@arturcic I have adjusted my local file to your fix. However, I now get this error:

C:\Users\Nutzer\.nuget\packages\gitversion.msbuild\5.6.4\tools\GitVersion.MsBuild.targets(9,9): error MSB3073: Der Befehl ""C:\Users\Nutzer\.nuget\packages\gitversion.msbuild\5.6.4\tools\net48/gitversion.exe" "C:\Users\Nutzer\Documents\Temp\Github\C# und VB\Serilog.Sinks.Telegram\src\Serilog.Sinks.Telegram" -output file -outputfile obj\gitversion.json" wurde mit dem Code 1 beendet.

But don't ask me, what's wrong now. If you want to test, use my project under https://github.com/SeppPenner/Serilog.Sinks.Telegram with a path that contains spaces. Maybe you can find out more...

Command line:

Microsoft Windows [Version 10.0.19041.746]
(c) 2020 Microsoft Corporation. Alle Rechte vorbehalten.

C:\WINDOWS\system32>"C:\Users\Nutzer\.nuget\packages\gitversion.msbuild\5.6.4\tools\net48/gitversion.exe" "C:\Users\Nutzer\Documents\Temp\Github\C# und VB\Serilog.Sinks.Telegram\src\Serilog.Sinks.Telegram" -output file -outputfile obj\gitversion.json"
INFO [01/28/21 21:39:31:49] Working directory: C:\Users\Nutzer\Documents\Temp\Github\C# und VB\Serilog.Sinks.Telegram\src\Serilog.Sinks.Telegram
INFO [01/28/21 21:39:31:51] Project root is: C:\Users\Nutzer\Documents\Temp\Github\C# und VB\Serilog.Sinks.Telegram\
INFO [01/28/21 21:39:31:51] DotGit directory is: C:\Users\Nutzer\Documents\Temp\Github\C# und VB\Serilog.Sinks.Telegram\.git
INFO [01/28/21 21:39:31:54] Begin: Loading version variables from disk cache
  INFO [01/28/21 21:39:31:54] Begin: Deserializing version variables from cache file C:\Users\Nutzer\Documents\Temp\Github\C# und VB\Serilog.Sinks.Telegram\.git\gitversion_cache\DECD9E87C0CC9305850ACD6A35CE75DBCA4602F6.yml
  INFO [01/28/21 21:39:31:59] End: Deserializing version variables from cache file C:\Users\Nutzer\Documents\Temp\Github\C# und VB\Serilog.Sinks.Telegram\.git\gitversion_cache\DECD9E87C0CC9305850ACD6A35CE75DBCA4602F6.yml (Took: 53.50ms)
  INFO [01/28/21 21:39:31:59] End: Loading version variables from disk cache (Took: 54.50ms)
  ERROR [01/28/21 21:39:31:68] An unexpected error occurred:
System.IO.DirectoryNotFoundException: Ein Teil des Pfades "C:\WINDOWS\system32\obj\gitversion.json" konnte nicht gefunden werden.
   bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   bei System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   bei System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   bei System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   bei System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   bei System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
   bei GitVersion.FileSystem.WriteAllText(String file, String fileContents) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Core\FileSystem.cs:Zeile 42.
   bei GitVersion.VersionConverters.OutputGenerator.OutputGenerator.Execute(VersionVariables variables, OutputContext context) in D:\a\GitVersion\GitVersion\src\GitVersionCore\VersionConverters\OutputGenerator\OutputGenerator.cs:Zeile 39.
   bei GitVersion.GitVersionOutputTool.OutputVariables(VersionVariables variables, Boolean updateBuildNumber) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Core\GitVersionOutputTool.cs:Zeile 42.
   bei GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersionExe\GitVersionExecutor.cs:Zeile 66.
  INFO [01/28/21 21:39:31:68] Attempting to show the current git graph (please include in issue):
  INFO [01/28/21 21:39:31:68] Showing max of 100 commits
  INFO [01/28/21 21:39:31:72] * f81b88f 4 minutes ago  (HEAD -> master, origin/master, origin/HEAD)
*   5fc8ab7 21 minutes ago
|\
| * 877c361 2 days ago
| * e4e1ae1 3 days ago
|/
* dd27c4a 2 weeks ago
* 124f098 3 weeks ago
* 7d2aea9 3 weeks ago  (tag: 1.0.7)
* 5ab0027 4 weeks ago  (tag: 1.0.6)
* ff56bb9 4 weeks ago
* b744730 4 weeks ago  (tag: 1.0.5)
* 8e646a3 4 weeks ago
*   3349b06 4 weeks ago
|\
| * cfa9759 9 months ago  (jessicah-origin/master)
* | 60c4560 4 weeks ago
* | 9bf0d87 4 weeks ago
* | 6e9ddb1 4 weeks ago
* | 2653445 4 weeks ago
* | 62d183f 4 weeks ago
* | 22d5d61 4 weeks ago
* | 0c14d3e 4 months ago  (tag: 1.0.4)
* | 9572efc 4 months ago
* | c8f57e3 4 months ago
* | 585f8e6 4 months ago
* | 30db99e 8 months ago  (tag: 1.0.3)
* | f58a4d9 8 months ago
* | 718aa3d 8 months ago
|/
* 5ff558d 9 months ago
* 3eb7b99 9 months ago
* c2c819c 9 months ago  (tag: 1.0.2)
* c29320e 1 year, 3 months ago
* f11ed6f 1 year, 3 months ago
* 16b6cf3 1 year, 3 months ago  (tag: 1.0.1)
* 28deab3 1 year, 3 months ago
* b6b710c 1 year, 3 months ago
* a0a042f 1 year, 7 months ago
* e80f820 1 year, 7 months ago
* b3a4ea5 1 year, 7 months ago

The problem seems to be -output file -outputfile obj\gitversion.json" in that case.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 5.6.5 :tada: The release is available on:

Your GitReleaseManager bot :package::rocket: