-
Notifications
You must be signed in to change notification settings - Fork 654
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
[Bug] GitVersion.MSBuild broken for WiX setup projects #2595
Comments
I am facing the same issue and although the linked issue mention some workaround, I am failing to understand what needs to be done. May I have some help? |
I am not sure if this helps, but for my WiX project, I had to add this to the .wixproj file to be able to build:
The The .msi file, though, will not have its own AssemblyVersion properties set. I don't know how that can be done. |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. |
Generate AssemblyInfo and GitVersionInformation files only for c#, f# and vb projects.
🎉 This issue has been resolved in version 6.0.0-beta.3 🎉 Your GitReleaseManager bot 📦🚀 |
Describe the bug
I have previously used
GitVersion.Task
nuget package in my Wix Toolset setup builds.After migrating to
GitVersion.MSBuild
, this no longer works.The problems seem to be centred around the handling of the
Language
parameter to theGetVersion
task.Build fails with the following error message:
The error is in the line that invokes
candle.exe
. All of the version properties are being correctly supplied (example:-dGitVersion_InformationalVersion=4.0.0-beta.105+Branch.release-4.0.0.Sha.730ef678c48a1a00ee8be97122c1d7be2f5268e5
but then right at the end of the line, the fileobj\Release\GitVersionInformation.g.cs
is being 'injected' into the build. This file does not exist and is not part of the project.. This is clearly not correct for a wix setup project.I believe this is happening because
Language
defaults to "C#" and GitVersion is therefore attempting to inject version metadata into the assembly being built. This clearly will not work for a Wix project, since no assembly is being built and there is no compile step being executed.I have tried:
Language
to something other than C#, such as "wix". This results in an "Invalid language detected" build error.Language
to empty string, results in error: "GenerateGitVersionInformation" task was not given a value for the required parameter "Language".<UpdateAssemblyInfo>False</UpdateAssemblyInfo>
in the .wixproj (no effect)Expected Behavior
This build should succeed and GitVersion should not try to inject any files into the build process.
Actual Behavior
GitVersion is incorrectly assuming that this is a C# project and is attempting to inject C# code into the build.
Possible Fix
It seems like a very C#-oriented mindset has led to some bad assumptions around how language-specific processing is handled.
This causes problems under Linux because
Language
is a commonly defined environment variable which gets picked up by the build (issue #2591).It causes problems in projects that don't have a normal "compile" step, such as Wix setup projects.
It will likely cause problems in other less common project types such as NDoc documentation projects.
It seems to me that what is missing is the recognition that GitVersion may be used from languages that it knows nothing about,
such as Wix, or NDoc, or from completely hand-crafted MSBuild project files that don't use the standard .NET build pipeline.
Consider this code in
FileHelper.cs
:What should I set
Language
to in a wix project? There is no valid value!!My suggestion would be to introduce a value of "none" or "other" which explicitly disables language specific processing, and make that the default. In fact, rather than throwing an error and failing the build for an unrecognized language, just disable language-specific processing and perhaps print a warning explaining to the user how to modify their project file to explicitly set
Language
to an appropriate value.Language
is set to a supported language, then do the appropriate language-specific processing.Language
is set toNone
then disable any language-specific processing.Language
is set to an unrecognized value, print a warning advising the user to set it toNone
and continue as if it had been set toNone
Language
has no value, default toNone
and continue.Language
is not recognized.There is no sense in defaulting to "C#" unless you know for sure you are in a C# project. That clearly doesn't work.
Steps to Reproduce
Assumption: Wix Toolset is installed and working in Visual Studio.
Product.wxs
and build. Verify build successful.GitVersion.MSBuild
via nuget package managerHere is a ready-made failing minimal project: https://github.com/NameOfTheDragon/GitVersion.Issue
Context
So far,
GitVersion.MSBuild
has caused problems at every stage of my solution.I'm still unable to release my build while I rely on GitVersion.
It's a complete showstopper.
Your Environment
https://github.com/NameOfTheDragon/GitVersion.Issue
The text was updated successfully, but these errors were encountered: