Skip to content

Commit ea69916

Browse files
committed
Documentation for Proj0500 and Proj0501
1 parent c5aeb20 commit ea69916

File tree

5 files changed

+75
-1
lines changed

5 files changed

+75
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ reported a the [GibHub repository](https://github.com/dotnet-project-file-analyz
119119
* [**Proj0452** Test projects require Microsoft.NET.Test.Sdk](rules/Proj0452.md)
120120
* [**Proj0453** Using Microsoft.NET.Test.Sdk implies a test project](rules/Proj0453.md)
121121

122+
### Licensing
123+
* [**Proj0500** Only include packages with an explicitly defined license](rules/Proj0500.md)
124+
* [**Proj0501** Only include packages with a compliant license](rules/Proj0501.md)
125+
122126
### .NET Project File Analyzers SDK
123127
* [**Proj0700** Avoid defining <Compile> items in SDK project](rules/Proj0700.md)
124128

navigation/general_project_rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
title: General
33
parent: MSBuild
44
ancestor: Rules
5-
nav_order: 9
5+
nav_order: 10
66
---

navigation/licensing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: MSBuild
3+
parent: Rules
4+
nav_order: 4
5+
---

rules/Proj0500.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
parent: Licening
3+
ancestor: Rules
4+
---
5+
6+
# Proj0500: Only include packages with an explicitly defined license
7+
Using a [NuGet](https://www.nuget.org) (third-party) package implies that you
8+
and/or your company explicitly agree with the legally binding conditions of the
9+
license and the copyright of the onwer of the package.
10+
11+
As Microsoft states it itself:
12+
> If a package does not specify the licensing terms, contact the package owner
13+
> directly using the Contact owners link on the [NuGet.org](https://www.nuget.org)
14+
> package page. Microsoft does not license any intellectual property to you
15+
> from third party package providers and is not responsible for information
16+
> provided by third parties.
17+
18+
When you use packages that are only (privatly) shared without your company
19+
those packages should also come with an explicitly defined license. You might
20+
need to contact your legal department to define a proper license.
21+
22+
## See
23+
* [NuGet.org frequently-asked questions](https://learn.microsoft.com/nuget/nuget-org/nuget-org-faq#license-terms)
24+
* [How to Avoid Costly Lawsuits from Unexpected NuGet License Agreements](https://blog.inedo.com/nuget/how-to-avoid-costly-lawsuits-from-unexpected-nuget-license-agreements/)

rules/Proj0501.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
parent: Licening
3+
ancestor: Rules
4+
---
5+
6+
# Proj0501: Only include packages with a compliant license
7+
Using a [NuGet](https://www.nuget.org) (third-party) package implies that you
8+
and/or your company explicitly agree with the legally binding conditions of the
9+
license and the copyright of the onwer of the package.
10+
11+
By default, MIT and Apache-2.0 are allowed.
12+
13+
## Configure
14+
You can specify which license (expressions) are allowed, using `<AllowedLicenses>`.
15+
16+
``` xml
17+
<Project Sdk="Microsoft.NET.Sdk">
18+
19+
<PropertyGroup>
20+
<AllowedLicenses>MIT,MPL-1.1,Apache-2.0</AllowedLicenses>
21+
</PropertyGroup>
22+
23+
</Project>
24+
```
25+
26+
For packages that do not come with a generic license (expression) such as MIT,
27+
it is possible to specify that these packages are allowed, using the
28+
`<AllowedThirdPartyPackages>`. Wildcard characters are allowed.
29+
30+
``` xml
31+
<Project Sdk="Microsoft.NET.Sdk">
32+
33+
<PropertyGroup>
34+
<AllowedThirdPartyPackages>
35+
SonarAnalyzer.Csharp,
36+
MyCompany.*
37+
/AllowedThirdPartyPackages>
38+
</PropertyGroup>
39+
40+
</Project>
41+
```

0 commit comments

Comments
 (0)