Skip to content

[Bug] GitVersion.MSBuild no longer works in WIX setup projects #2519

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

Closed
NameOfTheDragon opened this issue Jan 7, 2021 · 1 comment · Fixed by #2521
Closed

[Bug] GitVersion.MSBuild no longer works in WIX setup projects #2519

NameOfTheDragon opened this issue Jan 7, 2021 · 1 comment · Fixed by #2521
Labels

Comments

@NameOfTheDragon
Copy link

Describe the bug

TL;DR: The "GenerateGitVersionInformation" task was not given a value for the required parameter "Language".

Previously I was using GitVersion.Task package in my WIX setup projects to help version my installers. I would access environment variables to set the installer product version, then I would use the following target to name the output file:

  <Target Name="BeforeBuild" AfterTargets="GetVersion">
    <CreateProperty Value="$(OutputName).$(GitVersion_SemVer)">
      <Output TaskParameter="Value" PropertyName="TargetName" />
    </CreateProperty>
    <CreateProperty Value="$(TargetName)$(TargetExt)">
      <Output TaskParameter="Value" PropertyName="TargetFileName" />
    </CreateProperty>
    <CreateProperty Value="$(TargetDir)$(TargetFileName)">
      <Output TaskParameter="Value" PropertyName="TargetPath" />
    </CreateProperty>
  </Target>

I noticed that the GitVersion.Task package was marked Deprecated so I migrated to the replacement, GitVersion.MSBuild. However, this no longer works. When I build my installer, I get the following error:

0>D:\VS-Projects\TA.NexDome.AscomServer\packages\GitVersion.MsBuild.5.6.1\tools\net48/gitversion.exe D:\VS-Projects\TA.NexDome.AscomServer\TA.NexDome.Bootstrapper -output file -outputfile D:\VS-Projects\TA.NexDome.AscomServer\TA.NexDome.Bootstrapper/gitversion.json
0>D:\VS-Projects\TA.NexDome.AscomServer\packages\GitVersion.MsBuild.5.6.1\tools\GitVersion.MsBuild.targets(110,9): Error MSB4044: The "GenerateGitVersionInformation" task was not given a value for the required parameter "Language".
0>------- Finished building project: TA.NexDome.Bootstrapper. Succeeded: False. Errors: 1. Warnings: 0
Build completed in 00:00:04.008

Expected Behavior

I expected the new package to behave the same as the old one, since there should not have been any breaking changes.

Actual Behavior

New package produces build errors as shown above.

Context

The GitVersion.MSBuild package does not behave the same as the deprecated GitVersion.Task package and this would appear to be an unintentional breaking change. I can't build my project with the new package so I'm forced to use the deprecated package.

Your Environment

WIX Bootstrapper project using WIX Toolset 3.11, building in Visual Studio 2019.

@bddckr
Copy link
Contributor

bddckr commented Jan 8, 2021

I believe you need to set two properties to false now, as they don't make sense to run for your WIX project:

<PropertyGroup>
  <GenerateGitVersionInformation>false</GenerateGitVersionInformation>
  <UpdateAssemblyInfo>false</UpdateAssemblyInfo>
</PropertyGroup>

This way it only will run the one target you need.

Alternatively you could only set DisableGitVersionTask to false. If you do that you will have to manually ensure the one target you need is run:

<Target Name="BeforeBuild" DependsOnTargets="GetVersion">

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

Successfully merging a pull request may close this issue.

2 participants