-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Directory.Build.Common.targets
382 lines (308 loc) · 22.6 KB
/
Directory.Build.Common.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Versioning.targets" />
<Target Name="ValidateTargetFrameworks" BeforeTargets="Build">
<ItemGroup>
<RequiredTargetFrameworks Include="$(RequiredTargetFrameworks)" />
<ConfiguredTargetFrameworks Include="$(TargetFrameworks)" />
<MissingTargetFrameworks Include="@(RequiredTargetFrameworks)" Exclude="@(ConfiguredTargetFrameworks)" />
</ItemGroup>
<Error Condition="'@(RequiredTargetFrameworks)' == ''" Text="List of required target frameworks is empty something must have messed up property RequiredTargetFrameworks[$(RequiredTargetFrameworks)]." />
<Error Condition="'@(MissingTargetFrameworks)' != ''" Text="Missing required target frameworks '@(MissingTargetFrameworks)'. Please ensure you add those frameworks." />
</Target>
<!-- Set PackageProjectUrl and PackageReleaseNotes to the package README.md and CHANGELOG.md respectively for DataPlane Libraries -->
<Target Name="SetPackageProjectUrlandReleaseNotes" BeforeTargets="GenerateNuspec" DependsOnTargets="InitializeSourceControlInformationFromSourceControlManager" Condition="'$(IsShippingLibrary)' == 'true' and '$(SourceRevisionId)' != ''">
<Error Condition="'$(IsClientLibrary)' == 'true' and '$(PackageReleaseNotes)' != ''" Text="Do NOT set PackageReleaseNotes property in the project. Release notes are added automatically from package changelog" />
<PropertyGroup>
<PackageRootPath>$([MSBuild]::NormalizeDirectory($(MSBuildProjectDirectory)/../))</PackageRootPath>
<DirectoryPartofPath>$(PackageRootPath.Replace($(RepoRoot), ''))</DirectoryPartofPath>
<PackageProjectUrl Condition="Exists('$(PackageRootPath)/README.md') and '$(SkipDevBuildNumber)' != 'true'">$([System.UriBuilder]::new($(RepositoryUrl)/blob/$(SourceRevisionId)/$(DirectoryPartofPath)README.md).Uri)</PackageProjectUrl>
<PackageProjectUrl Condition="Exists('$(PackageRootPath)/README.md') and '$(SkipDevBuildNumber)' == 'true'">$([System.UriBuilder]::new($(RepositoryUrl)/blob/$(PackageId)_$(Version)/$(DirectoryPartofPath)README.md).Uri)</PackageProjectUrl>
<PackageReleaseNotes Condition="Exists('$(PackageRootPath)/CHANGELOG.md') and '$(SkipDevBuildNumber)' != 'true'">$([System.UriBuilder]::new($(RepositoryUrl)/blob/$(SourceRevisionId)/$(DirectoryPartofPath)CHANGELOG.md).Uri)</PackageReleaseNotes>
<PackageReleaseNotes Condition="Exists('$(PackageRootPath)/CHANGELOG.md') and '$(SkipDevBuildNumber)' == 'true'">$([System.UriBuilder]::new($(RepositoryUrl)/blob/$(PackageId)_$(Version)/$(DirectoryPartofPath)CHANGELOG.md).Uri)</PackageReleaseNotes>
</PropertyGroup>
</Target>
<!-- Validates that there is a release note entry for the current package version -->
<Target Name="ValidateReleaseNotes" BeforeTargets="SetPackageProjectUrlandReleaseNotes" Condition="'$(IsShippingLibrary)' == 'true'" >
<PropertyGroup>
<ValidateReleaseNotesScriptPath Condition=" '$(ValidateReleaseNotesScriptPath)'=='' ">$(MSBuildThisFileDirectory)common/scripts/Verify-ChangeLog.ps1</ValidateReleaseNotesScriptPath>
<ChangeLogPath>$([MSBuild]::NormalizeDirectory($(MSBuildProjectDirectory)/../))CHANGELOG.md</ChangeLogPath>
</PropertyGroup>
<Exec ContinueOnError="true" ConsoleToMSBuild="true" StandardOutputImportance="High" Command="$(PowerShellExe) -NoProfile -NonInteractive -executionpolicy Unrestricted -File $(ValidateReleaseNotesScriptPath) -ChangeLogLocation $(ChangeLogPath) -VersionString $(_VersionInProject)">
<Output TaskParameter="ExitCode" PropertyName="SetReleaseNotesErrorCode" />
</Exec>
<Error Condition="'$(SetReleaseNotesErrorCode)' != '0'" Text="ChangeLog verification failed for [$(ChangeLogPath)]." />
</Target>
<!--Run Aggregate Updates to Source -->
<Target Name="UpdateSourceOnBuild" AfterTargets="Build" Condition="'$(UpdateSourceOnBuild)' == 'true' and '$(IsShippingClientLibrary)' == 'true'" >
<PropertyGroup>
<CodeChecksScriptPath Condition=" '$(CodeChecksScriptPath)'=='' ">$(MSBuildThisFileDirectory)scripts/CodeChecks.ps1</CodeChecksScriptPath>
</PropertyGroup>
<Exec ConsoleToMSBuild="true" Command="$(PowerShellExe) -NoProfile -NonInteractive -executionpolicy Unrestricted -File $(CodeChecksScriptPath) -ProjectDirectory $(MSBuildProjectDirectory)"/>
</Target>
<PropertyGroup>
<OriginalReadmeMdPath>$([MSBuild]::NormalizeDirectory($(MSBuildProjectDirectory)/../))README.md</OriginalReadmeMdPath>
<ProcessedReadmeMdPath>$(IntermediateOutputPath)README.md</ProcessedReadmeMdPath>
<EnableNuGetReadmeMd Condition="'$(DesignTimeBuild)' != 'true' and Exists('$(OriginalReadmeMdPath)')">true</EnableNuGetReadmeMd>
<PackageReadmeFile Condition="'$(EnableNuGetReadmeMd)' == 'true'">README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<None Condition="'$(EnableNuGetReadmeMd)' != 'true' and Exists('$(OriginalReadmeMdPath)')" Include="$(OriginalReadmeMdPath)" Pack="true" PackagePath="/"/>
<None Condition="'$(EnableNuGetReadmeMd)' == 'true'" Include="$(ProcessedReadmeMdPath)" Pack="true" PackagePath="/"/>
</ItemGroup>
<!-- Process and pack README.md -->
<Target Name="ProcessReadmeMd" BeforeTargets="GenerateNuspec" Condition="'$(EnableNuGetReadmeMd)' == 'true'" >
<PropertyGroup>
<_ReadmeMdLines>$([System.IO.File]::ReadAllText($(OriginalReadmeMdPath)))</_ReadmeMdLines>
<!-- remove comments https://github.com/NuGet/NuGetGallery/issues/8627 -->
<_ReadmeMdLines><![CDATA[$([System.Text.RegularExpressions.Regex]::Replace('$(_ReadmeMdLines)', '\<\!--.*?-->', ''))]]></_ReadmeMdLines>
<!-- remove impressions image -->
<_ReadmeMdLines><![CDATA[$([System.Text.RegularExpressions.Regex]::Replace('$(_ReadmeMdLines)', '\!\[Impressions\]\(.*?\)', ''))]]></_ReadmeMdLines>
</PropertyGroup>
<WriteLinesToFile File="$(ProcessedReadmeMdPath)" Lines="$(_ReadmeMdLines)" Overwrite="true" WriteOnlyWhenDifferent="true" />
</Target>
<!-- This allows us to build .NET Framework targets on non-windows
TODO: Move the NETFramework reference assemblies to a feed other then the roslyn feed.
-->
<ItemGroup Condition="'$(IsTargetingNetFx)' == 'true' and '$(OS)' != 'Windows_NT'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="all" IsImplicitlyDefined="true" />
</ItemGroup>
<!-- Add Client SDK Tools -->
<ItemGroup>
<PackageReference Condition="'$(IsClientLibrary)' == 'true'" Include="Microsoft.Azure.AutoRest.CSharp" PrivateAssets="All" />
<PackageReference Condition="'$(GenerateAPIListing)' == 'true'" Include="Microsoft.DotNet.GenAPI" PrivateAssets="All" />
<PackageReference Condition="'$(EnableClientSdkAnalyzers)' == 'true'" Include="Azure.ClientSdk.Analyzers" PrivateAssets="All" />
<PackageReference Condition="'$(EnableMicrosoftCodeAnalysisNetAnalyzers)' == 'true'" Include="Microsoft.CodeAnalysis.NetAnalyzers" PrivateAssets="All" />
<PackageReference Condition="'$(EnableBannedApiAnalyzers)' == 'true'" Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" PrivateAssets="All" />
</ItemGroup>
<!-- Add Package Icon to DataPlane Packages -->
<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<None Include="$(PackageIconPath)" Pack="true" PackagePath=""/>
<None Condition="Exists('$(MSBuildProjectDirectory)/../CHANGELOG.md')" Include="$(MSBuildProjectDirectory)/../CHANGELOG.md" Pack="true" PackagePath=""/>
</ItemGroup>
<!-- Add App.config to enable server GC in net462 perf and stress projects -->
<ItemGroup Condition="('$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true') and '$(TargetFramework)' == 'net462'">
<None Include="$(RepoRoot)/common/Perf/App.config" />
</ItemGroup>
<!-- Add StyleCop Analyzers -->
<ItemGroup Condition="'$(EnableStyleCopAnalyzers)' == 'true'" >
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<AdditionalFiles Include="$(RepoEngPath)\stylecop.json">
<Visible>false</Visible>
</AdditionalFiles>
</ItemGroup>
<ItemGroup Condition="'$(IsClientLibrary)' == 'true'">
<AdditionalFiles Include="$(RepoEngPath)\BannedSymbols.txt">
<Visible>false</Visible>
</AdditionalFiles>
</ItemGroup>
<!-- Enable SourceLink -->
<ItemGroup Condition="'$(EnableSourceLink)' == 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>
<PropertyGroup>
<ImportDefaultReferences Condition="'$(ImportDefaultReferences)' == ''">true</ImportDefaultReferences>
<DefaultReferenceTargets>AzSdk.reference.targets</DefaultReferenceTargets>
<DefaultReferenceTargets Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true'">AzSdk.test.reference.targets</DefaultReferenceTargets>
<!-- Disable running of tests for test helper libraries -->
<IsTestProject Condition="'$(IsTestSupportProject)' == 'true'">false</IsTestProject>
</PropertyGroup>
<PropertyGroup Condition="'$(InheritDocEnabled)' != 'false' and '$(TargetFramework)' == 'netstandard2.0'">
<NoWarn>
$(NoWarn);IDT001<!-- InheritDoc related to malformed XML in netstandard.xml -->
</NoWarn>
</PropertyGroup>
<Import Project="$(DefaultReferenceTargets)" Condition="Exists('$(DefaultReferenceTargets)') And '$(ImportDefaultReferences)'=='true'" />
<Import Project="ApiListing.targets" />
<Import Project="CodeCoverage.targets" Condition="'$(CollectCoverage)' == 'true'" />
<Import Project="CodeGeneration.targets" Condition="'$(TemporaryUsePreviousGeneratorVersion)' == 'true'" />
<Import Project="Azure.Management.Test.targets" Condition="'$(IsMgmtLibrary)' == 'true' and '$(IsTestProject)' == 'true'" />
<!-- CentralPackageVersions properties -->
<PropertyGroup>
<CentralPackagesFile>$(MSBuildThisFileDirectory)Packages.Data.props</CentralPackagesFile>
<CentralPackageVersionPackagePath>$(MSBuildThisFileDirectory)Microsoft.Build.CentralPackageVersions\2.0.46\Sdk</CentralPackageVersionPackagePath>
<UseProjectReferenceToAzureClients Condition="'$(UseProjectReferenceToAzureClients)' == ''">false</UseProjectReferenceToAzureClients>
</PropertyGroup>
<ItemGroup Condition="'$(UseProjectReferenceToAzureClients)' == 'true'">
<!-- Find all non-management projects -->
<AzureProjects Include="$(RepoRoot)/sdk/**/src/*.csproj" Exclude="$(RepoRoot)/sdk/**/src/*.Management.*.csproj" ProjectPath="%(Identity)" />
<PossibleProjectsToConvert Include="@(AzureProjects -> '%(Filename)')"/>
<!-- Compute set of projects that intersect with the PackageReference's -->
<_NotPackageReferences Include="@(PossibleProjectsToConvert)" Exclude="@(PackageReference)" />
<_NotPackageReferences Include="@(ExcludeFromProjectReferenceToConversion)" />
<ProjectsToConvert Include="@(PossibleProjectsToConvert)" Exclude="@(_NotPackageReferences)" />
<!-- Remove PackageReferences -->
<PackageReference Remove="@(ProjectsToConvert)" />
<!-- Add ProjectReferences -->
<ProjectReference Include="@(ProjectsToConvert -> '%(ProjectPath)')" />
</ItemGroup>
<!--TODO: update build targets - ADO 5668-->
<PropertyGroup>
<MgmtCoreShared>$(MSBuildThisFileDirectory)/../sdk/resourcemanager/Azure.ResourceManager/src/Shared</MgmtCoreShared>
<ExcludeMgmtCoreShared Condition="'$(ExcludeMgmtCoreShared)' == ''">false</ExcludeMgmtCoreShared>
</PropertyGroup>
<ItemGroup Condition="'$(IsMgmtSubLibrary)' == 'true' and '$(IsMgmtLibrary)' == 'true' and '$(IsTestProject)' != 'true' and '$(ExcludeMgmtCoreShared)' == 'false'">
<Compile Include="$(MgmtCoreShared)/**/*.cs"
LinkBase="Shared/Management" />
</ItemGroup>
<!--TODO: end-->
<!-- *********** Files needed for LRO ************* -->
<ItemGroup Condition="'$(IncludeOperationsSharedSource)' == 'true'">
<Compile Include="$(AzureCoreSharedSources)AsyncLockWithValue.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)OperationHelpers.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)VoidValue.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)OperationInternal.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)OperationInternalBase.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)OperationInternalOfT.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)SequentialDelayStrategy.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)FixedDelayWithNoJitterStrategy.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)OperationPoller.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)ClientDiagnostics.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)DiagnosticScope.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)DiagnosticScopeFactory.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)HttpMessageSanitizer.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)Argument.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)ContentTypeUtilities.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)TaskExtensions.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)AppContextSwitchHelper.cs" LinkBase="Shared/Core" />
</ItemGroup>
<!-- *********** Management Client Library Override section ************* -->
<ItemGroup Condition="'$(IsMgmtLibrary)' == 'true' and '$(IsTestProject)' != 'true'">
<PackageReference Include="Azure.Core" />
<PackageReference Include="System.Text.Json" />
<!-- TODO: Review these file references-->
<Compile Include="$(AzureCoreSharedSources)ArrayBufferWriter.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)AzureResourceProviderNamespaceAttribute.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)ForwardsClientCallsAttribute.cs" LinkBase="Shared/Core" />
<Compile Include="$(AzureCoreSharedSources)ApiVersionString.cs" LinkBase="Shared/Core" />
</ItemGroup>
<!-- DataFactory Project Specific Overrides-->
<ItemGroup Condition="$(MSBuildProjectName) == 'Azure.ResourceManager.DataFactory'">
<PackageReference Include="Azure.Core.Expressions.DataFactory"/>
</ItemGroup>
<!-- Management Client TEST Project Specific Overrides -->
<ItemGroup Condition="('$(IsMgmtLibrary)' == 'true' and '$(IsTestProject)' == 'true') or '$(IsStorageTest)' == 'true'">
<ProjectReference Condition="'$(IsMgmtLibrary)' == 'true' and '$(IsTestProject)' == 'true'" Include="$(AzureCoreTestFramework)" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
</ItemGroup>
<!-- *********** END OF Management Client Library Override section ************* -->
<!-- Added layer of checks to make sure we correctly switched to project references -->
<Target Name="VerifyProjectReferencesReferences" AfterTargets="Build">
<ItemGroup>
<AzureReferences Include="@(ReferencePath)" Condition="$([System.String]::Copy('%(Filename)').StartsWith('Azure.'))" />
</ItemGroup>
<ItemGroup Condition="'$(UseProjectReferenceToAzureClients)' == 'true'">
<ShouldBeProjectReference Include="@(AzureReferences)" Exclude="@(AzureReferences->HasMetadata('MSBuildSourceProjectFile'))" />
</ItemGroup>
<Error Condition="'$(UseProjectReferenceToAzureClients)' == 'true' and '@(ShouldBeProjectReference)' != ''"
Text="When UseProjectReferenceToAzureClients=true all Azure.* references should be Project References, but the following are not [@(ShouldBeProjectReference)]" />
</Target>
<!-- Added layer of checks to make sure release packages don't have preview dependencies -->
<Target Name="VerifyProjectReferencesReferences" Condition="'$(HasReleaseVersion)' == 'true' AND '$(IsPackable)' == 'true'" BeforeTargets="GenerateNuspec">
<Msbuild
Projects="@(_ProjectReferencesFromAssetsFile)"
Targets="_GetProjectVersion"
SkipNonexistentTargets="true"
SkipNonexistentProjects="true"
Properties="BuildProjectReferences=false;SkipDevBuildNumber=true">
<Output
TaskParameter="TargetOutputs"
ItemName="_ProjectReferencesWithoutDevVersions"/>
</Msbuild>
<ItemGroup>
<_AllReferencesWithVersions Include="@(_ProjectReferencesWithoutDevVersions)" Version="%(ProjectVersion)" />
<_AllReferencesWithVersions Include="@(PackageReference)" Condition="!$([System.String]::Copy('%(PackageReference.PrivateAssets)').ToLower().Equals('all'))"/>
<PreviewPackageReferences Include="@(_AllReferencesWithVersions)" Condition="$([System.String]::Copy('%(Version)').Contains('-'))" />
</ItemGroup>
<Error Condition="'@(PreviewPackageReferences)' != ''" Text="When the project has a release version it shouldn't reference any pre-release libraries. Found the following pre-release references: @(PreviewPackageReferences, ', ')" />
</Target>
<!-- Validates that all the mgmt libraries have a trigger path in the core resourcemanager pipeline -->
<Target Name="ValidateResourceManagerPipelineTriggers" AfterTargets="Build" Condition="'$(IsMgmtSubLibrary)' == 'true' and '$(IsShippingLibrary)' == 'true'" >
<PropertyGroup>
<_ResourceManagerCIFile>$(RepoRoot)/sdk/resourcemanager/ci.mgmt.yml</_ResourceManagerCIFile>
<_ResourceManagerCIFileContents>$([System.IO.File]::ReadAllText($(_ResourceManagerCIFile)))</_ResourceManagerCIFileContents>
<_ContainsTrigger>$([System.Text.RegularExpressions.Regex]::IsMatch($(_ResourceManagerCIFileContents), `- sdk/.*/$(MSBuildProjectName)\W+`))</_ContainsTrigger>
</PropertyGroup>
<Error Condition="'$(_ContainsTrigger)' != 'true'" Text="The core resourcemanager pipeline ['$(_ResourceManagerCIFile)'] does not contain a trigger path for your library please run 'eng/scripts/Update-Mgmt-CI.ps1' to add the correct trigger paths." />
</Target>
<!-- InheritDoc-->
<ItemGroup Condition="'$(InheritDocEnabled)' != 'false'">
<PackageReference Include="SauceControl.InheritDoc" PrivateAssets="all" />
</ItemGroup>
<!-- Fixup netstandard2.malformed docs issue https://github.com/saucecontrol/InheritDoc#bad-netstandard-docs -->
<ItemGroup Condition="'$(InheritDocEnabled)' != 'false' and '$(TargetFramework)' == 'netstandard2.0'">
<PackageDownload Include="NETStandard.Library.Ref" />
<InheritDocReference Include="$(NugetPackageRoot)\netstandard.library.ref\2.1.0\ref\netstandard2.1\netstandard.xml" />
</ItemGroup>
<!-- Additional PackageReferences should be placed above this PropertyGroup -->
<PropertyGroup>
<ApiCompatExcludeAttributeList>$(MSBuildThisFileDirectory)ApiListing.exclude-attributes.txt</ApiCompatExcludeAttributeList>
</PropertyGroup>
<ItemGroup Condition="'$(ApiCompatVersion)' != ''">
<PackageDownload Include="$(PackageId)" Version="[$(ApiCompatVersion)]" />
<PackageReference Include="Microsoft.DotNet.ApiCompat" PrivateAssets="all" />
</ItemGroup>
<Target Name="_ResolveResolvedMatchingContract" BeforeTargets="ValidateApiCompatForSrc" Condition="'$(ApiCompatVersion)' != ''">
<ItemGroup>
<_ReferencePathDirectories Include="@(ReferencePath -> '%(RootDir)%(Directory)')" />
<ResolvedMatchingContract Include="$(NuGetPackageRoot)\$(PackageId.ToLower())\$(ApiCompatVersion)\lib\$(TargetFramework)\$(TargetFileName)">
<DependencyPaths>@(_ReferencePathDirectories->Distinct(), ',')</DependencyPaths>
</ResolvedMatchingContract>
</ItemGroup>
</Target>
<Target Name="ApiCompatFinishedMessage" AfterTargets="ValidateApiCompatForSrc" Condition="'$(ApiCompatVersion)' != ''">
<Message Text="Ran ApiCompat against %(ResolvedMatchingContract.Identity) using assemblies from $(IntermediateOutputPath)" Importance="High" />
</Target>
<Target Name="RunApiCompat" DependsOnTargets="ValidateApiCompatForSrc" Condition="'$(ApiCompatVersion)' != ''">
</Target>
<Target Name="GetPackageInfo">
<PropertyGroup>
<PackageIsNewSdk>false</PackageIsNewSdk>
<PackageIsNewSdk Condition="'$(IsClientLibrary)' == 'true'">true</PackageIsNewSdk>
<PackageSdkType>data</PackageSdkType>
<PackageSdkType Condition="'$(IsClientLibrary)' == 'true'">client</PackageSdkType>
<PackageSdkType Condition="'$(IsMgmtLibrary)' == 'true'">mgmt</PackageSdkType>
<PackageRootDirectory>$([MSBuild]::NormalizeDirectory($(MSBuildProjectDirectory)/../).TrimEnd("/").TrimEnd("\\"))</PackageRootDirectory>
<!-- If the AddDevVersion property is true this will output the generated dev version (e.g. 1.0.0-alpha.20210921.1) -->
<VersionForProperties>$(_VersionInProject)</VersionForProperties>
<VersionForProperties Condition="'$(AddDevVersion)' == 'true'">$(Version)</VersionForProperties>
<!-- Parse out the service directory based on the relative path to the sdk folder -->
<ServiceDirectory><![CDATA[$([System.Text.RegularExpressions.Regex]::Replace($(PackageRootDirectory), '^.*[\\/]+sdk[\\/]+([^\\/]+).*$', '$1'))]]></ServiceDirectory>
</PropertyGroup>
<Message Condition="'$(IsShippingLibrary)' == 'true'" Text="'$(PackageRootDirectory)' '$(ServiceDirectory)' '$(PackageId)' '$(VersionForProperties)' '$(PackageSdkType)' '$(PackageIsNewSdk)' '$(BaseOutputPath)'" Importance="High" />
</Target>
<Target Name="GetCodeGenProjects" Returns="@(ProjectsToInclude)">
<ItemGroup Condition="'$(_GenerateCode)' == 'true'">
<ProjectsToInclude Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
</Target>
<Target Name="_SetProjectDependsOnInnerTarget">
<PropertyGroup>
<InnerTargets>ProjectDependsOnInner</InnerTargets>
</PropertyGroup>
</Target>
<Target
Name="ProjectDependsOn"
DependsOnTargets="_SetProjectDependsOnInnerTarget;DispatchToInnerBuilds"
Condition="'$(IsCrossTargetingBuild)' == 'true'"
Returns="@(ProjectsToInclude)">
<RemoveDuplicates Inputs="@(InnerOutput)">
<Output TaskParameter="Filtered" ItemName="ProjectsToInclude"/>
</RemoveDuplicates>
</Target>
<Target Name="ProjectDependsOnInner" DependsOnTargets="ResolveReferences" Returns="@(ProjectsToInclude)">
<ItemGroup>
<_LibrariesReferenced Include="@(ReferencePath -> '%(Filename)')"/>
<_DependsOnGiven Include="@(_LibrariesReferenced)" Condition="'%(Identity)' == '$(TestDependsOnDependency)'" />
</ItemGroup>
<ItemGroup Condition="'@(_DependsOnGiven)' != '' and '$(IsClientLibrary)' == 'true'" >
<ProjectsToInclude Include="$(MSBuildProjectFullPath)" />
</ItemGroup>
</Target>
<Import Project="$(CentralPackageVersionPackagePath)\Sdk.targets" />
</Project>