|
25 | 25 | <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> |
26 | 26 | <PackagePrimaryLicenseFile>$(RepoRoot)\LICENSE.TXT</PackagePrimaryLicenseFile> |
27 | 27 | <PackageThirdPartyNoticesFile>$(RepoRoot)\THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile> |
| 28 | + <PackageReadmeFile>README.md</PackageReadmeFile> |
| 29 | + <PackageReleaseNotes>RELEASENOTES.md</PackageReleaseNotes> |
28 | 30 | </PropertyGroup> |
29 | 31 |
|
30 | 32 | <PropertyGroup Label="SourceLinkProperties"> |
|
57 | 59 | <None Include=".publicApi\**\PublicAPI.*.txt" /> |
58 | 60 | </ItemGroup> |
59 | 61 |
|
60 | | - <Target Name="AssemblyVersionTarget" AfterTargets="MinVer" Condition="'$(MinVerVersion)'!='' AND '$(BuildNumber)' != ''"> |
| 62 | + <Target Name="AssemblyVersionTarget" AfterTargets="MinVer" Condition="'$(MinVerVersion)' != '' AND '$(BuildNumber)' != ''"> |
61 | 63 | <!-- Note: $(BuildNumber) is typically only set for builds initiated by the |
62 | 64 | publish workflow. The goal here is to set the assembly FileVersion and |
63 | 65 | resolve ExposeExperimentalFeatures based on the version MinVer resolved from |
|
87 | 89 | <Error Text="Cannot perform package validation without a baseline package version." /> |
88 | 90 | </Target> |
89 | 91 |
|
| 92 | + <Target Name="IncludeReadmeAndReleaseNotesInPackages" BeforeTargets="_GetTargetFrameworksOutput"> |
| 93 | + <!-- Note: This target runs during pack to convert relative links in |
| 94 | + markdowns into github permalinks which will work when rendered on Nuget. --> |
| 95 | + |
| 96 | + <Exec |
| 97 | + Command="git rev-parse HEAD" |
| 98 | + ConsoleToMsBuild="True" |
| 99 | + IgnoreExitCode="True" |
| 100 | + StandardOutputImportance="low"> |
| 101 | + <Output PropertyName="GitCommitConsoleOutput" TaskParameter="ConsoleOutput"/> |
| 102 | + <Output PropertyName="GitCommitExitCode" TaskParameter="ExitCode"/> |
| 103 | + </Exec> |
| 104 | + |
| 105 | + <Exec |
| 106 | + Command="git remote get-url origin" |
| 107 | + ConsoleToMsBuild="True" |
| 108 | + IgnoreExitCode="True" |
| 109 | + StandardOutputImportance="low"> |
| 110 | + <Output PropertyName="GitOriginConsoleOutput" TaskParameter="ConsoleOutput"/> |
| 111 | + <Output PropertyName="GitOriginExitCode" TaskParameter="ExitCode"/> |
| 112 | + </Exec> |
| 113 | + |
| 114 | + <PropertyGroup> |
| 115 | + <GitHubPermalinkUrl>$(GitOriginConsoleOutput.Replace('.git',''))/blob/$(GitCommitConsoleOutput)</GitHubPermalinkUrl> |
| 116 | + </PropertyGroup> |
| 117 | + |
| 118 | + <Message Importance="high" Text="**GitInformationDebug** GitCommitConsoleOutput: $(GitCommitConsoleOutput), GitCommitExitCode: $(GitCommitExitCode), GitOriginConsoleOutput: $(GitOriginConsoleOutput), GitOriginExitCode: $(GitOriginExitCode), GitHubPermalinkUrl: $(GitHubPermalinkUrl)" /> |
| 119 | + |
| 120 | + <ItemGroup> |
| 121 | + <PackageMarkdownFiles Include="README.md" /> |
| 122 | + <PackageMarkdownFiles Include="$(RepoRoot)\RELEASENOTES.md" /> |
| 123 | + </ItemGroup> |
| 124 | + |
| 125 | + <ItemGroup> |
| 126 | + <PackageMarkdownFiles Update="@(PackageMarkdownFiles)" Path="$([MSBuild]::ValueOrDefault('%(FullPath)','').Replace('$(RepoRoot)', '').Replace('%(FileName)%(Extension)', ''))" /> |
| 127 | + </ItemGroup> |
| 128 | + |
| 129 | + <WriteLinesToFile |
| 130 | + File="$(BaseIntermediateOutputPath)%(PackageMarkdownFiles.Filename)%(PackageMarkdownFiles.Extension)" |
| 131 | + Lines="$([System.Text.RegularExpressions.Regex]::Replace($([System.IO.File]::ReadAllText(%(PackageMarkdownFiles.FullPath))), '\[([^]]+?)\]\(\.(.+?)\)', '[$1]($(GitHubPermalinkUrl)%(PackageMarkdownFiles.Path).$2)'))" |
| 132 | + Overwrite="true" |
| 133 | + Encoding="UTF-8"/> |
| 134 | + |
| 135 | + <ItemGroup> |
| 136 | + <Content Include="$(BaseIntermediateOutputPath)*.md" PackagePath="/" /> |
| 137 | + </ItemGroup> |
| 138 | + </Target> |
| 139 | + |
90 | 140 | <Target Name="ResolveExposeExperimentalFeatures" BeforeTargets="CoreCompile" DependsOnTargets="AssemblyVersionTarget"> |
91 | 141 | <!-- Note: This runs for all builds. The goal here is to set the |
92 | 142 | EXPOSE_EXPERIMENTAL_FEATURES compiler constant if |
|
0 commit comments