|
37 | 37 | <!-- Only difference is we don't copy either to output directory --> |
38 | 38 |
|
39 | 39 | <!-- Project-level icon/readme will already be part of None items --> |
40 | | - <None Update="@(None -> WithMetadataValue('Filename', 'icon'))" Pack="true" PackagePath="%(Filename)%(Extension)" CopyToOutputDirectory="Never" Condition="'$(PackageIcon)' != ''" /> |
41 | | - |
42 | | - <None Update="@(None -> WithMetadataValue('Filename', 'readme'))" Pack="true" PackagePath="%(Filename)%(Extension)" CopyToOutputDirectory="Never" Condition="'$(PackReadme)' != 'false' and '$(PackageReadmeFile)' != ''" /> |
| 40 | + <None Update="@(None -> WithMetadataValue('Filename', 'icon'))" |
| 41 | + Pack="true" PackagePath="%(Filename)%(Extension)" |
| 42 | + CopyToOutputDirectory="Never" |
| 43 | + Condition="'$(PackageIcon)' != ''" /> |
| 44 | + |
| 45 | + <None Update="@(None -> WithMetadataValue('Filename', 'readme'))" |
| 46 | + Pack="true" PackagePath="%(Filename)%(Extension)" |
| 47 | + CopyToOutputDirectory="Never" |
| 48 | + Condition="'$(PackReadme)' != 'false' and '$(PackageReadmeFile)' != ''" /> |
43 | 49 |
|
44 | 50 | <!-- src-level will need explicit inclusion --> |
45 | | - <None Include="$(MSBuildThisFileDirectory)icon.png" Link="icon.png" Visible="false" Pack="true" PackagePath="%(Filename)%(Extension)" CopyToOutputDirectory="Never" Condition="Exists('$(MSBuildThisFileDirectory)icon.png') and !Exists('$(MSBuildProjectDirectory)\icon.png')" /> |
46 | | - |
47 | | - <None Include="$(MSBuildThisFileDirectory)readme.md" Link="readme.md" Pack="true" PackagePath="%(Filename)%(Extension)" CopyToOutputDirectory="Never" Condition="'$(PackReadme)' != 'false' and Exists('$(MSBuildThisFileDirectory)readme.md') and !Exists('$(MSBuildProjectDirectory)\readme.md')" /> |
| 51 | + <None Include="$(MSBuildThisFileDirectory)icon.png" Link="icon.png" Visible="false" |
| 52 | + Pack="true" PackagePath="%(Filename)%(Extension)" |
| 53 | + CopyToOutputDirectory="Never" |
| 54 | + Condition="Exists('$(MSBuildThisFileDirectory)icon.png') and !Exists('$(MSBuildProjectDirectory)\icon.png')" /> |
| 55 | + |
| 56 | + <None Include="$(MSBuildThisFileDirectory)readme.md" Link="readme.md" |
| 57 | + Pack="true" PackagePath="%(Filename)%(Extension)" |
| 58 | + CopyToOutputDirectory="Never" |
| 59 | + Condition="'$(PackReadme)' != 'false' and Exists('$(MSBuildThisFileDirectory)readme.md') and !Exists('$(MSBuildProjectDirectory)\readme.md')" /> |
48 | 60 | </ItemGroup> |
49 | 61 |
|
50 | 62 | <!-- Microsoft.NET.Sdk\targets\Microsoft.NET.DefaultAssemblyInfo.targets does this and is imported |
|
103 | 115 | <!-- Consider the project out of date if any of these files changes --> |
104 | 116 | <UpToDateCheck Include="@(None);@(Content);@(EmbeddedResource)" /> |
105 | 117 | <!-- Opt-in to typed resource generation by setting custom tool to MSBuild:Compile --> |
106 | | - <EmbeddedResource Update="@(EmbeddedResource -> WithMetadataValue('Generator', 'MSBuild:Compile'))" Type="Resx"> |
| 118 | + <EmbeddedResource Update="@(EmbeddedResource -> WithMetadataValue('Generator', 'MSBuild:Compile'))" Type="Resx"> |
107 | 119 | <!-- Default to Just Works resources generation. See https://www.cazzulino.com/resources.html --> |
108 | 120 | <StronglyTypedFileName>$(IntermediateOutputPath)\$([MSBuild]::ValueOrDefault('%(RelativeDir)', '').Replace('\', '.').Replace('/', '.'))%(Filename).g$(DefaultLanguageSourceExtension)</StronglyTypedFileName> |
109 | 121 | <StronglyTypedLanguage>$(Language)</StronglyTypedLanguage> |
|
129 | 141 | </ItemGroup> |
130 | 142 |
|
131 | 143 | <!-- Make sure the source control info is available before calling source generators --> |
132 | | - <Target Name="EnsureProjectInformation" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun" AfterTargets="InitializeSourceControlInformation" DependsOnTargets="InitializeSourceControlInformation"> |
| 144 | + <Target Name="EnsureProjectInformation" |
| 145 | + BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun" |
| 146 | + AfterTargets="InitializeSourceControlInformation" |
| 147 | + DependsOnTargets="InitializeSourceControlInformation"> |
133 | 148 |
|
134 | 149 | <PropertyGroup Condition="'$(SourceControlInformationFeatureSupported)' == 'true'"> |
135 | 150 | <!-- The project must specify PublishRepositoryUrl=true in order to publish the URL, in order to prevent inadvertent leak of internal URL. --> |
|
145 | 160 |
|
146 | 161 | <!-- Add SourceRoot as a project property too --> |
147 | 162 | <ItemGroup> |
148 | | - <_GitSourceRoot Include="@(SourceRoot -> WithMetadataValue('SourceControl', 'git'))" /> |
| 163 | + <_GitSourceRoot Include="@(SourceRoot -> WithMetadataValue('SourceControl', 'git'))" /> |
149 | 164 | </ItemGroup> |
150 | 165 |
|
151 | 166 | <PropertyGroup> |
152 | 167 | <RepositoryRoot>@(_GitSourceRoot)</RepositoryRoot> |
| 168 | + <!-- Only change if it wasn't just the default from Microsoft.NET.DefaultAssemblyInfo.targets --> |
| 169 | + <ProductFromUrl Condition="'$(SourceControlInformationFeatureSupported)' == 'true'">$([System.IO.Path]::GetFileNameWithoutExtension($(PrivateRepositoryUrl)))</ProductFromUrl> |
| 170 | + <Product Condition="'$(Product)' == '$(AssemblyName)' and '$(ProductFromUrl)' != ''">$(ProductFromUrl)</Product> |
153 | 171 | </PropertyGroup> |
154 | 172 |
|
155 | 173 | </Target> |
156 | 174 |
|
157 | | - <Target Name="UpdatePackageMetadata" BeforeTargets="PrepareForBuild;GenerateMSBuildEditorConfigFileShouldRun;GetAssemblyVersion;GetPackageMetadata;GenerateNuspec;Pack" DependsOnTargets="EnsureProjectInformation" Condition="'$(SourceControlInformationFeatureSupported)' == 'true' And '$(IsPackable)' == 'true'"> |
| 175 | + <Target Name="UpdatePackageMetadata" |
| 176 | + BeforeTargets="PrepareForBuild;GenerateMSBuildEditorConfigFileShouldRun;GetAssemblyVersion;GetPackageMetadata;GenerateNuspec;Pack" |
| 177 | + DependsOnTargets="EnsureProjectInformation" |
| 178 | + Condition="'$(SourceControlInformationFeatureSupported)' == 'true' And |
| 179 | + '$(IsPackable)' == 'true'"> |
158 | 180 | <PropertyGroup> |
159 | | - <PackageProjectUrl Condition="'$(PackageProjectUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(RepositoryUrl)</PackageProjectUrl> |
| 181 | + <PackageProjectUrl Condition="'$(PackageProjectUrl)' == '' and '$(PublishRepositoryUrl)' == 'true'">$(RepositoryUrl.Replace('.git', ''))</PackageProjectUrl> |
160 | 182 | <PackageDescription>$(Description)</PackageDescription> |
161 | | - <PackageReleaseNotes Condition="'$(RepositoryUrl)' != '' and Exists('$(MSBuildThisFileDirectory)..\changelog.md')">$(RepositoryUrl)/blob/main/changelog.md</PackageReleaseNotes> |
| 183 | + <PackageReleaseNotes Condition="'$(RepositoryUrl)' != '' and Exists('$(MSBuildThisFileDirectory)..\changelog.md')">$(RepositoryUrl.Replace('.git', ''))/blob/main/changelog.md</PackageReleaseNotes> |
162 | 184 | </PropertyGroup> |
163 | 185 | </Target> |
164 | 186 |
|
165 | 187 | <!-- Import before UsingTask because first to declare tasks wins --> |
166 | | - <Import Project="Directory.targets" Condition="Exists('Directory.targets')" /> |
| 188 | + <Import Project="Directory.targets" Condition="Exists('Directory.targets')"/> |
167 | 189 | <Import Project="Directory.targets.user" Condition="Exists('Directory.targets.user')" /> |
168 | 190 |
|
169 | 191 | </Project> |
0 commit comments