Repository navigation
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
43 lines (41 loc) · 2.18 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
43 lines (41 loc) · 2.18 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
<Project>
<!-- The default name of the generated file contains a comma, which F# embed mishandles, so it would not be embedded. -->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.fsproj'">
<TargetFrameworkMonikerAssemblyAttributesPath>$(IntermediateOutputPath)$(TargetFramework).AssemblyAttributes.fs</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<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>
<!-- The SDK-generated AssemblyAttributes.fs is added to Compile after EmbedUntrackedSources has run for F# projects,
so embed it explicitly. -->
<Target Name="EmbedGeneratedFsSources" BeforeTargets="CoreCompile" Condition="'$(MSBuildProjectExtension)' == '.fsproj' and '$(EmbedUntrackedSources)' == 'true'">
<ItemGroup>
<EmbeddedFiles Include="@(Compile)" Condition="$([System.String]::Copy('%(FullPath)').StartsWith('$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)))'))" KeepDuplicates="false" />
</ItemGroup>
</Target>
<!-- 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>