This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
167 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)build\CheckPackageReferences.targets" /> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<PropertyGroup> | ||
<MSBuildAllProjects>$(MSBuildThisFileFullPath);$(MSBuildAllProjects)</MSBuildAllProjects> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Label="Package versions used by this repository"> | ||
<!-- | ||
When referencing a new package, update this list with a matching Include and the desired version. When updating | ||
a package, remove the Version from an individual project and update the Version in this file instead. | ||
--> | ||
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="[15.3.409]" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="[15.3.0]" /> | ||
<PackageVersion Include="Microsoft.NETCore.App" Version="[1.1.2]" /> | ||
<PackageVersion Include="NUnit" Version="[3.8.1]" /> | ||
<PackageVersion Include="NUnit3TestAdapter" Version="[3.8.0]" /> | ||
<PackageVersion Include="NETStandard.Library" Version="[1.6.1]" /> | ||
<PackageVersion Include="Nerdbank.GitVersioning" Version="[2.0.37-beta]" PrivateAssets="All" /> | ||
<PackageVersion Include="Shouldly" Version="[2.8.2]" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Label="Packages to add to all projects"> | ||
<!-- | ||
To reference a package in all projects, add it to this list. Be sure to specify also specify a PackageVersion above. | ||
--> | ||
<GlobalPackageReference Include="Nerdbank.GitVersioning" Condition=" '$(EnableGitVersioning)' != 'false' " /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project InitialTargets="CheckPackageReferences" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<PropertyGroup> | ||
<MSBuildAllProjects>$(MSBuildThisFileFullPath);$(MSBuildAllProjects)</MSBuildAllProjects> | ||
<CentralPackagesFile Condition=" '$(CentralPackagesFile)' == '' ">$([MSBuild]::GetPathOfFileAbove('Packages.props'))</CentralPackagesFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- Stores the package versions specified in individual projects --> | ||
<ProjectSpecifiedPackageVersion Include="@(PackageVersion)" /> | ||
</ItemGroup> | ||
|
||
<Import Project="$(CentralPackagesFile)" /> | ||
|
||
<ItemGroup> | ||
|
||
<!-- Clear package versions that are duplicated from a project and the central package versions file --> | ||
<PackageVersion Remove="@(ProjectSpecifiedPackageVersion)" /> | ||
|
||
<!-- Add back the project specified package versions --> | ||
<PackageVersion Include="@(ProjectSpecifiedPackageVersion)" /> | ||
|
||
<!-- Stores the original package references used later to determine if there are any problems --> | ||
<OriginalPackageReference Include="@(PackageReference)" /> | ||
|
||
<!-- Add global package references --> | ||
<PackageReference Include="@(GlobalPackageReference)" /> | ||
|
||
<!-- Store all PackageVersion items that do not have a PackageReference --> | ||
<_PackagesNotReferenced Include="@(PackageVersion)" Exclude="@(PackageReference)" /> | ||
|
||
<!-- Clear the PackageReference list --> | ||
<PackageReference Remove="@(OriginalPackageReference);@(GlobalPackageReference)" /> | ||
|
||
<!-- Add back the PackageReference its from the list that contains versions, excluding the items not referenced --> | ||
<PackageReference Include="@(PackageVersion)" Exclude="@(_PackagesNotReferenced)" /> | ||
|
||
<!-- Clear the temporary list of items not referenced --> | ||
<_PackagesNotReferenced Remove="@(_PackagesNotReferenced)" /> | ||
|
||
</ItemGroup> | ||
|
||
<Target Name="CheckPackageReferences" | ||
Condition=" '@(PackageReference)' != '' "> | ||
|
||
<ItemGroup> | ||
<!-- | ||
Determine all of the original PackageReference items that did not have a PackageVersion | ||
--> | ||
<MissingPackageReference Include="@(OriginalPackageReference)" Exclude="@(PackageVersion)" /> | ||
|
||
<!-- | ||
Determine all of the PackageReference items that are already declared as GlobalPackageReference items. | ||
--> | ||
<DuplicateGlobalPackageReference Include="@(OriginalPackageReference)" Condition=" '@(GlobalPackageReference)' == '@(OriginalPackageReference)' and '%(Identity)' != '' " /> | ||
</ItemGroup> | ||
|
||
<!-- | ||
Generate an error if any PackageReference has a version specified and its not an implicit item | ||
--> | ||
<Error | ||
Text="The package reference '%(OriginalPackageReference.Identity)' should not specify a version. Please specify the version in '$(CentralPackagesFile)'." | ||
Condition=" '%(OriginalPackageReference.IsImplicitlyDefined)' != 'true' And '%(OriginalPackageReference.Version)' != '' " | ||
File="$(MSBuildProjectFullPath) "/> | ||
|
||
<!-- | ||
Generate an error if any explicit PackageReference did not have matching PackageVersion | ||
--> | ||
<Error | ||
Text="The package reference '%(MissingPackageReference.Identity)' must have a version defined in '$(CentralPackagesFile)'." | ||
Condition=" '@(MissingPackageReference)' != '' And '%(MissingPackageReference.IsImplicitlyDefined)' != 'true' " | ||
File="$(MSBuildProjectFullPath)" /> | ||
|
||
<!-- | ||
Generate an error if any implicit PackageReference did not have matching PackageVersion | ||
--> | ||
<Error | ||
Text="The implicit package reference '%(MissingPackageReference.Identity)' must have a version defined in '$(CentralPackagesFile)'." | ||
Condition=" '@(MissingPackageReference)' != '' And '%(MissingPackageReference.IsImplicitlyDefined)' == 'true' " | ||
File="$(MSBuildProjectFullPath)" /> | ||
|
||
<!-- | ||
Generate an error if any project specified a PackageReference and there is already the same GlobalPackageReference | ||
--> | ||
<Error | ||
Text="The package reference '%(DuplicateGlobalPackageReference.Identity)' is already defined as a GlobalPackageReference in '$(CentralPackagesFile)'. Individual projects do not need to include a PackageReference if a GlobalPackageReference is declared." | ||
Condition=" '@(DuplicateGlobalPackageReference)' != '' " | ||
File="$(MSBuildProjectFullPath)" /> | ||
|
||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", | ||
"version": "1.0", // required | ||
"assemblyVersion": "1.0", // optional. Use when x.y for AssemblyVersionAttribute differs from the default version property. | ||
"buildNumberOffset": 0, // optional. Use when you need to add/subtract a fixed value from the computed build number. | ||
"semVer1NumericIdentifierPadding": 4, // optional. Use when your -prerelease includes numeric identifiers and need semver1 support. | ||
"nugetPackageVersion": { | ||
"semVer": 1 // optional. Set to either 1 or 2 to control how the NuGet package version string is generated. Default is 1. | ||
}, | ||
"publicReleaseRefSpec": [ | ||
"^refs/heads/master$", // we release out of master | ||
"^refs/tags/v\\d+\\.\\d+" // we also release tags starting with vN.N | ||
], | ||
"cloudBuild": { | ||
"setVersionVariables": true, | ||
"buildNumber": { | ||
"enabled": false, | ||
"includeCommitId": { | ||
"when": "nonPublicReleaseOnly", | ||
"where": "buildMetadata" | ||
} | ||
} | ||
} | ||
} |