Skip to content

Commit

Permalink
Improve support of WPF projects
Browse files Browse the repository at this point in the history
Toward a better workaround for #404
  • Loading branch information
AArnott committed Nov 15, 2019
1 parent 2b0c747 commit 12b34ac
Showing 1 changed file with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="NBGV_SetDefaults">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>

<PrepareForBuildDependsOn>
GenerateNativeVersionInfo;
$(PrepareForBuildDependsOn);
</PrepareForBuildDependsOn>

<PrepareResourcesDependsOn>
GenerateAssemblyVersionInfo;
$(PrepareResourcesDependsOn)
</PrepareResourcesDependsOn>

<CoreCompileDependsOn>
GenerateAssemblyVersionInfo;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>

<VersionDependsOn>
GetNuPkgVersion;
$(VersionDependsOn)
Expand All @@ -33,9 +18,6 @@
$(GetPackageVersionDependsOn)
</GetPackageVersionDependsOn>

<!-- Suppress assembly version info generation if not obviously compiling an assembly. -->
<GenerateAssemblyVersionInfo Condition=" '$(GenerateAssemblyVersionInfo)' == '' and '$(TargetExt)' != '.dll' and '$(TargetExt)' != '.exe'">false</GenerateAssemblyVersionInfo>

<!-- Suppress version attribute generation in Microsoft.NET.Sdk projects to avoid build failures
when two sets of attributes are emitted. -->
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
Expand All @@ -53,6 +35,32 @@
<UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.GetBuildVersion"/>
<UsingTask AssemblyFile="$(NerdbankGitVersioningTasksPath)Nerdbank.GitVersioning.Tasks.dll" TaskName="Nerdbank.GitVersioning.Tasks.CompareFiles"/>

<Target Name="NBGV_SetDefaults">
<!-- Workarounds for https://github.com/AArnott/Nerdbank.GitVersioning/issues/404 -->
<PropertyGroup>
<!-- $(TargetExt) isn't set at evaluation time for us when built in wpftmp.csproj with manual imports -->
<!-- Suppress assembly version info generation if not obviously compiling an assembly. -->
<GenerateAssemblyVersionInfo Condition=" '$(GenerateAssemblyVersionInfo)' == '' and '$(TargetExt)' != '.dll' and '$(TargetExt)' != '.exe'">false</GenerateAssemblyVersionInfo>

<!-- Workaround the property stomping that msbuild does (see https://github.com/microsoft/msbuild/pull/4922) with manual imports. -->
<PrepareForBuildDependsOn>
GenerateNativeVersionInfo;
$(PrepareForBuildDependsOn);
</PrepareForBuildDependsOn>

<PrepareResourcesDependsOn>
GenerateAssemblyVersionInfo;
$(PrepareResourcesDependsOn)
</PrepareResourcesDependsOn>

<CoreCompileDependsOn>
GenerateAssemblyVersionInfo;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>

</PropertyGroup>
</Target>

<PropertyGroup>
<!-- Consider building a tag to be more precise than the branch we're building. -->
<_NBGV_BuildingRef>$(_NBGV_BuildingTag)</_NBGV_BuildingRef>
Expand Down

0 comments on commit 12b34ac

Please sign in to comment.