File tree Expand file tree Collapse file tree 4 files changed +73
-11
lines changed Expand file tree Collapse file tree 4 files changed +73
-11
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,8 @@ reported a the [GibHub repository](https://github.com/dotnet-project-file-analyz
130130* [ ** Proj0805** Define version for PackageReference] ( rules/Proj0805.md )
131131* [ ** Proj0806** VersionOverride should change the version] ( rules/Proj0806.md )
132132* [ ** Proj0807** Use Directory.Packages.props only for Central Package Management] ( rules/Proj0807.md )
133+ * [ ** Proj0808** Define global package reference only in Directory.Packages.props] ( rules/Proj0808.md )
134+ * [ ** Proj0809** Global package references are meant for private assets only] ( rules/Proj0809.md )
133135
134136### Analyzers
135137* [ ** Proj1000** Use the .NET project file analyzers] ( rules/Proj1000.md )
Original file line number Diff line number Diff line change @@ -23,15 +23,11 @@ work otherwise, it is counter-intuitive and recipe for disaster.
2323
2424 <ItemGroup >
2525 <PackageVersion Include =" Qowaiv" Version =" 7.0.0" />
26- <PackageVersion Include =" PolySharp " Version =" 1.14.1 " />
26+ <PackageVersion Include =" DotNetProjectFile.Analyzers " Version =" 1.5.8 " />
2727 </ItemGroup >
2828
2929 <ItemGroup >
30- <GlobalPackageReference Include =" System.Text.Json" Vesion =" 8.0.4" />
31- </ItemGroup >
32-
33- <ItemGroup >
34- <PackageReference Include =" PolySharp" PrivateAssets =" all" />
30+ <PackageReference Include =" DotNetProjectFile.Analyzers" PrivateAssets =" all" />
3531 </ItemGroup >
3632
3733 <ItemGroup >
@@ -40,7 +36,6 @@ work otherwise, it is counter-intuitive and recipe for disaster.
4036 </ItemGroup >
4137
4238</Project >
43-
4439```
4540
4641## Compliant
@@ -56,17 +51,15 @@ work otherwise, it is counter-intuitive and recipe for disaster.
5651
5752 <ItemGroup >
5853 <PackageVersion Include =" Qowaiv" Version =" 7.0.0" />
59- <PackageVersion Include =" PolySharp" Version =" 1.14.1" />
6054 </ItemGroup >
61-
55+
6256 <ItemGroup >
63- <GlobalPackageReference Include =" System.Text.Json " Vesion =" 8.0.4 " />
57+ <GlobalPackageReference Include =" DotNetProjectFile.Analyzers " Vesion =" 1.5.8 " />
6458 </ItemGroup >
6559
6660 <ItemGroup >
6761 <AdditionalFiles Include =" Directory.Packages.props" Link =" Properties/Directory.Packages.props" />
6862 </ItemGroup >
6963
7064</Project >
71-
7265```
Original file line number Diff line number Diff line change 1+ ---
2+ parent : Central Package Management
3+ ancestor : Rules
4+ ---
5+
6+ # Proj0808: Define global package reference only in Directory.Packages.props
7+ When using [ Central Package Management] ( Proj0800.md ) the central ` Directory.Packages.props `
8+ it is possible to define package reference globally with the use of
9+ [ ` <GlobalPackageReference> ` ] ( https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management#global-package-references ) .
10+ This references should be in your ` Directory.Packages.props ` only.
11+
12+
13+ ## Compliant
14+ If defined in ` Directory.Packages.props `
15+ ``` xml
16+ <Project >
17+
18+ <PropertyGroup >
19+ <ManagePackageVersionsCentrally >true</ManagePackageVersionsCentrally >
20+ </PropertyGroup >
21+
22+ <ItemGroup >
23+ <GlobalPackageReference Include =" DotNetProjectFile.Analyzers" Vesion =" 1.5.8" />
24+ </ItemGroup >
25+
26+ </Project >
27+ ```
Original file line number Diff line number Diff line change 1+ ---
2+ parent : Central Package Management
3+ ancestor : Rules
4+ ---
5+
6+ # Proj0809: Global package references are meant for private assets only
7+ When using [ Central Package Management] ( Proj0800.md ) the central ` Directory.Packages.props `
8+ it is possible to define package reference globally with the use of
9+ [ ` <GlobalPackageReference> ` ] ( https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management#global-package-references ) .
10+ This should only be used for references that should be handled as a private asset.
11+
12+ ## Non-compliant
13+ ``` xml
14+ <Project >
15+
16+ <PropertyGroup >
17+ <ManagePackageVersionsCentrally >true</ManagePackageVersionsCentrally >
18+ </PropertyGroup >
19+
20+ <ItemGroup >
21+ <GlobalPackageReference Include =" Qowaiv" Vesion =" 7.0.0" />
22+ </ItemGroup >
23+
24+ </Project >
25+ ```
26+
27+ ## Compliant
28+ ``` xml
29+ <Project >
30+
31+ <PropertyGroup >
32+ <ManagePackageVersionsCentrally >true</ManagePackageVersionsCentrally >
33+ </PropertyGroup >
34+
35+ <ItemGroup >
36+ <GlobalPackageReference Include =" DotNetProjectFile.Analyzers" Vesion =" 1.5.8" />
37+ </ItemGroup >
38+
39+ </Project >
40+ ```
You can’t perform that action at this time.
0 commit comments