Skip to content

[ISSUE]: GitVersion.MsBuild 6.5.1 on VS 2026 ... MsBuild Exception for WiX projects #4767

@dorssel

Description

@dorssel

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.MsBuild

GitVersion version

6.5.1

Operating system

Windows

What are you seeing?

@arturcic
First of all: very nice to see VS support again. I've immediately reverted back from Dorssel.GitVersion.MsBuild to mainstream GitVersion.MsBuild. See dorssel/usbipd-win@a3f552a

However, the Installer project (https://github.com/dorssel/usbipd-win/blob/master/Installer/Installer.wixproj) uses WixToolset.Sdk, and in combination with GitVersion.MsBuild 6.5.1 it gives the following MSBuild exception in VS 2026:

1>MSBUILD : error : This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled
1>MSBUILD : error :     System.ArgumentNullException: Parameter "projectFile" cannot be null.
1>MSBUILD : error :    at Microsoft.Build.Shared.ErrorUtilities.ThrowArgumentNull(String parameterName, String resourceName)
1>MSBUILD : error :    at Microsoft.Build.Exceptions.InvalidProjectFileException..ctor(String projectFile, Int32 lineNumber, Int32 columnNumber, Int32 endLineNumber, Int32 endColumnNumber, String message, String errorSubcategory, String errorCode, String helpKeyword, Exception innerException)
1>MSBUILD : error :    at Microsoft.Build.Exceptions.InvalidProjectFileException..ctor(String message, InvalidProjectFileException innerException)
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.<InitializeAndExecuteTask>d__24.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteBucket>d__19.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteTask>d__18.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteTask>d__13.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetEntry.<ProcessBucket>d__50.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetEntry.<ExecuteTarget>d__43.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetBuilder.<ProcessTargetStack>d__24.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>MSBUILD : error :    at Microsoft.Build.BackEnd.TargetBuilder.<BuildTargets>d__11.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.<BuildProject>d__67.MoveNext()
1>MSBUILD : error : --- End of stack trace from previous location where exception was thrown ---
1>MSBUILD : error :    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1>MSBUILD : error :    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>MSBUILD : error :    at Microsoft.Build.BackEnd.RequestBuilder.<RequestThreadProc>d__58.MoveNext()

Sure enough that is also an MsBuild problem (unhandled exception), but it was triggered by GitVersion. It may have something to do with: https://github.com/GitTools/GitVersion/blob/main/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.props#L45-L51. The exception mentions Parameter "projectFile" cannot be null and the GitVersion comment mentions injecting _TargetAssemblyProjectName.

Additional information: The RunGitVersion task is run successfully before the exception occurs (gitversion.json created correctly). However, the exception occurs soon after that, I don't see other artifacts before the MsBuild crash.

What is expected?

VS 2026 MsBuild does not crash when referencing GitVersion.MsBuild in a WiX project.

Steps to Reproduce

Build https://github.com/dorssel/usbipd-win Installer project from within VS 2026.

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions