-
Notifications
You must be signed in to change notification settings - Fork 157
/
Directory.Build.targets
31 lines (30 loc) · 1.29 KB
/
Directory.Build.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<Project>
<UsingTask TaskName="Base64Decode" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<EncodedString ParameterType="System.String" Required="true" />
<DecodedString Output="true" ParameterType="System.String" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.Text" />
<Code Type="Fragment" Language="cs">
<![CDATA[
DecodedString = Encoding.UTF8.GetString(Convert.FromBase64String(EncodedString));
]]>
</Code>
</Task>
</UsingTask>
<!-- This is the decode end of the base64-encoding that gets the release notes into `dotnet pack`.
The problem is that we can't supply MsBuild properties that contain MsBuild metacharacters.
(At least, I don't know how.)
The release notes are liable to contain MsBuild property metacharacters, such as the comma;
so just before we `dotnet pack`, we base64-encode it. -->
<Target Name="DecodeReleaseNotes" BeforeTargets="GenerateNuspec">
<Base64Decode EncodedString="$(RELEASE_NOTES)">
<Output TaskParameter="DecodedString" PropertyName="DecodedReleaseNotes" />
</Base64Decode>
<PropertyGroup>
<PackageReleaseNotes>$(DecodedReleaseNotes)</PackageReleaseNotes>
</PropertyGroup>
</Target>
</Project>