Skip to content

Commit b35c8a4

Browse files
committed
Clarify WPF specific concerns with MSBuild
A couple of errors can arise when using GitVersion.MSBuild with different versions of the .NET Core SDK. This will help users know what to do based off what version they are using (not necessarily what they are targeting).
1 parent db23e17 commit b35c8a4

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

docs/input/docs/usage/msbuild.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,39 @@ The next thing you need to do is to remove the `Assembly*Version` attributes fro
5151
your `Properties\AssemblyInfo.cs` files. This puts GitVersion.MsBuild in charge of
5252
versioning your assemblies.
5353

54-
DotNet SDK-style projects will generate Assembly Version info along with other
55-
Assembly Info in a 'projectname.AssemblyInfo.cs' file, conflicting with GitVersion.
56-
So, you will need to edit your project. Add [GenerateAssemblyFileVersionAttribute](https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#generateassemblyfileversionattribute)
57-
under the first PropertyGroup and set it to `false`:
54+
### WPF specific concerns
55+
56+
One futhur step needs to be taken for SDK-style WPF projects.
57+
58+
Building projects with .NET Core SDK with a version lower than v5.0.200
59+
requires turning off automatic generation of the different versioning attributes.
60+
GitVersion usually controls these properties but cannot during WPF specific
61+
targets that generate a temporary project.
5862

5963
```xml
60-
<!-- GitVersion DotNet SDK Compatibility -->
61-
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
64+
<PropertyGroup>
65+
<!-- Wpf workaround: GitVersion and .NET SDK < v5.0.200 -->
66+
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
67+
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
68+
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
69+
</PropertyGroup>
6270
```
6371

72+
For .NET Core SDK v5.0.200 to v6.0.0-preview.1, a opt-in flag was introduced to
73+
allow package references to be imported to the temporary project.
74+
You can now remove the previous versioning attributes and replace them with
75+
a single property.
76+
77+
```xml
78+
<PropertyGroup>
79+
<!-- WPF workaround: GitVersion and .NET SDK between v5.0.200 and v6.0.0-preview.2 -->
80+
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
81+
</PropertyGroup>
82+
```
83+
84+
You can remove all workarounds if you are building with .NET Core SDK
85+
v6.0.0-preview.2 or later as the flag is now opt-out.
86+
6487
### Done!
6588

6689
The setup process is now complete and GitVersion.MsBuild should be working its magic,

0 commit comments

Comments
 (0)