Skip to content

Commit

Permalink
sets assembly versioninfo during build
Browse files Browse the repository at this point in the history
  • Loading branch information
skamphuis committed Apr 16, 2021
1 parent ee3f3ad commit 0fc0000
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions OpenContent/BuildScripts/ModulePackage.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="MSBuild.Community.Tasks.Targets" />

<PropertyGroup>
<AssemblyInfoFile>$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs</AssemblyInfoFile>
</PropertyGroup>

<Target Name="BeforeBuild">
<CallTarget Targets="SetVersionInfo" />
</Target>

<!-- Set the version numbers in AssemblyInfo -->
<Target Name="SetVersionInfo">
<XmlRead Prefix="n"
Namespace="http://schemas.microsoft.com/developer/msbuild/2003"
XPath="dotnetnuke/packages/package[1]/@version"
XmlFileName="$(DNNFileName).dnn">
<Output TaskParameter="Value" PropertyName="Version" />
</XmlRead>
<!-- Write new version to assemblyinfo.cs -->
<FileUpdate Files="$(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyVersion(&quot;$(Version)&quot;)" />
<FileUpdate Files="$(AssemblyInfoFile)" Encoding="ASCII" Regex="AssemblyFileVersion\(&quot;.*&quot;\)" ReplacementText="AssemblyFileVersion(&quot;$(Version)&quot;)" />
</Target>

<Target Name="PackageModule" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<XmlRead Prefix="n"
Expand Down

0 comments on commit 0fc0000

Please sign in to comment.