Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix path separator for gitversion.dll in MSBuild task #4087

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

vruss
Copy link

@vruss vruss commented Jul 9, 2024

Description

I looked at #2547 on how they solved the path seperator issue. The linked issue and I have still have the same issue and from looking at the code I think this can fix the issue.

Related Issue

#2993

My error I'm trying to fix:

0>GitVersion.MsBuild.targets(9,9): Error MSB3073 : The command "dotnet --roll-forward Major "C:\Users\[REDACTED]\.nuget\packages\gitversion.msbuild\5.7.0\tools\netcoreapp3.1/gitversion.dll" "C:\src\[REDACTED]\[REDACTED]" -output file -outputfile obj\gitversion.json" exited with code 1.

Motivation and Context

We should not hardcode path seperators as they are environment dependent.

How Has This Been Tested?

Nothing has been tested. I can't figure out how to actually build it locally. The build.ps1 script gives me this error

----------------------------------------
Setup
----------------------------------------
Could not execute because the specified command or file was not found.

----------------------------------------
TearDown
----------------------------------------
Starting Teardown...
Target:               Default
Build Agent:          Local
OS:                   Windows
Pull Request:         False
Repository Name:
Original Repository:  False
Branch Name:          issue-4086
Main Branch:          False
Support Branch:       False
Tagged:               False
IsStableRelease:      False
IsTaggedPreRelease:   False
IsInternalPreRelease: False
Finished running tasks.
Error: GitVersion: Process returned an error (exit code 1).

Screenshots (if appropriate):

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation. -don't think need documentation change
  • I have updated the documentation accordingly. -don't think need documentation change
  • I have added tests to cover my changes. -did not find tests
  • All new and existing tests passed.

@vruss
Copy link
Author

vruss commented Jul 10, 2024

@asbjornu the pipeline is failing. Looks like the $([MSBuild]::EnsureTrailingSlash(...) are not being evaluated for some reason.

========================================
  ArtifactsMsBuildFullTest
  ========================================
  
  Testing msbuild task with dotnet build
  
    Determining projects to restore...
    Restored D:\a\GitVersion\GitVersion\tests\integration\app.csproj (in 7.4 sec).
    Possible reasons for this include:
      * You misspelled a built-in dotnet command.
      * You intended to execute a .NET program, but dotnet---roll-forward does not exist.
    Could not execute because the specified command or file was not found.
      * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
  C:\Users\runneradmin\.nuget\packages\gitversion.msbuild\6.0.0-pullrequest[40](https://github.com/GitTools/GitVersion/actions/runs/9850619274/job/27240832984?pr=4087#step:5:42)87.1561\tools\GitVersion.MsBuild.targets(21,9): error MSB3073: The command "dotnet --roll-forward Major "$([MSBuild]::EnsureTrailingSlash($(MSBuildThisFileDirectory)$(TargetFramework))gitversion.dll" "D:\a\GitVersion\GitVersion\tests\integration"  -output file -outputfile "obj\gitversion.json"" exited with code 1. [D:\a\GitVersion\GitVersion\tests\integration\app.csproj::TargetFramework=net6.0]
  
  Build FAILED.
  
  C:\Users\runneradmin\.nuget\packages\gitversion.msbuild\6.0.0-pullrequest4087.1561\tools\GitVersion.MsBuild.targets(21,9): error MSB3073: The command "dotnet --roll-forward Major "$([MSBuild]::EnsureTrailingSlash($(MSBuildThisFileDirectory)$(TargetFramework))gitversion.dll" "D:\a\GitVersion\GitVersion\tests\integration"  -output file -outputfile "obj\gitversion.json"" exited with code 1. [D:\a\GitVersion\GitVersion\tests\integration\app.csproj::TargetFramework=net6.0]
      0 Warning(s)
      1 Error(s)

@asbjornu
Copy link
Member

@vruss is that supposed to be a built-in function? If not, can you define it somehow?

@arturcic
Copy link
Member

arturcic commented Jul 10, 2024

@vruss is that supposed to be a built-in function? If not, can you define it somehow?

@asbjornu

https://learn.microsoft.com/en-us/visualstudio/msbuild/property-functions?view=vs-2022#msbuild-ensuretrailingslash

@arturcic arturcic added this to the 6.x milestone Jul 16, 2024
@arturcic arturcic merged commit 1fa4304 into GitTools:main Jul 16, 2024
149 checks passed
Copy link
Contributor

mergify bot commented Jul 16, 2024

Thank you @vruss for your contribution!

@arturcic arturcic modified the milestones: 6.x, 6.0.0-rc.2 Jul 16, 2024
@arturcic
Copy link
Member

🎉 This issue has been resolved in version 6.0.0-rc.2 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants