|
117 | 117 | </None> |
118 | 118 | <None Include="packages.config" /> |
119 | 119 | </ItemGroup> |
| 120 | + <UsingTask TaskName="ReplaceFileText" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> |
| 121 | + <ParameterGroup> |
| 122 | + <InputFilename ParameterType="System.String" Required="true" /> |
| 123 | + <OutputFilename ParameterType="System.String" Required="true" /> |
| 124 | + <MatchExpression ParameterType="System.String" Required="true" /> |
| 125 | + <ReplacementText ParameterType="System.String" Required="true" /> |
| 126 | + </ParameterGroup> |
| 127 | + <Task> |
| 128 | + <Reference Include="System.Core" /> |
| 129 | + <Using Namespace="System" /> |
| 130 | + <Using Namespace="System.IO" /> |
| 131 | + <Using Namespace="System.Text.RegularExpressions" /> |
| 132 | + <Code Type="Fragment" Language="cs"> |
| 133 | + <![CDATA[ |
| 134 | + File.WriteAllText( |
| 135 | + OutputFilename, |
| 136 | + Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText) |
| 137 | + ); |
| 138 | + ]]> |
| 139 | + </Code> |
| 140 | + </Task> |
| 141 | + </UsingTask> |
120 | 142 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
121 | 143 | <PropertyGroup> |
| 144 | + <PostBuildEventDependsOn> |
| 145 | + $(PostBuildEventDependsOn); |
| 146 | + PostBuildMacros; |
| 147 | + </PostBuildEventDependsOn> |
122 | 148 | <PostBuildEvent>"C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool.exe" sign /sha1 "$(CSCERTTHUMBPRINT)" /t http://timestamp.digicert.com /fd sha256 /v "$(TargetFileName)" |
123 | 149 |
|
124 | 150 | "C:\Program Files\Debugging Tools for Windows (x64)\symstore" add /f "$(TargetDir)*.pdb" /s \\localhost\symbols /t "$(ProjectName)" /v "@(VersionNumber)" |
|
129 | 155 | </PreBuildEvent> |
130 | 156 | </PropertyGroup> |
131 | 157 | <Import Project="..\packages\Fody.1.29.2\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.2\build\dotnet\Fody.targets')" /> |
| 158 | + <Target Name="PostBuildMacros"> |
| 159 | + <GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> |
| 160 | + <Output TaskParameter="Assemblies" ItemName="Targets" /> |
| 161 | + </GetAssemblyIdentity> |
| 162 | + <ItemGroup> |
| 163 | + <VersionNumber Include="@(Targets->'%(Version)')" /> |
| 164 | + </ItemGroup> |
| 165 | + </Target> |
132 | 166 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
133 | 167 | <PropertyGroup> |
134 | 168 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
135 | 169 | </PropertyGroup> |
136 | 170 | <Error Condition="!Exists('..\packages\Fody.1.29.2\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.2\build\dotnet\Fody.targets'))" /> |
137 | 171 | </Target> |
| 172 | + <Target Name="AfterBuild"> |
| 173 | + <ReplaceFileText InputFilename="$(TargetDir)LithnetRMA.psd1" OutputFilename="$(TargetDir)LithnetRMA.psd1" MatchExpression="\$version\$" ReplacementText="@(VersionNumber)" /> |
| 174 | + <ReplaceFileText InputFilename="$(ProjectDir)LithnetRMA.Help.pshproj" OutputFilename="$(ProjectDir)LithnetRMA.Help.pshproj" MatchExpression="<Version>.*?<\/Version>" ReplacementText="<Version>@(VersionNumber)</Version>" /> |
| 175 | + </Target> |
138 | 176 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
139 | 177 | Other similar extension points exist, see Microsoft.Common.targets. |
140 | 178 | <Target Name="BeforeBuild"> |
|
0 commit comments