VDimensions.MSBuild.Sdk.Copyrighting
0.8.35
dotnet add package VDimensions.MSBuild.Sdk.Copyrighting --version 0.8.35
NuGet\Install-Package VDimensions.MSBuild.Sdk.Copyrighting -Version 0.8.35
<PackageReference Include="VDimensions.MSBuild.Sdk.Copyrighting" Version="0.8.35"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="VDimensions.MSBuild.Sdk.Copyrighting" Version="0.8.35" />
<PackageReference Include="VDimensions.MSBuild.Sdk.Copyrighting"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add VDimensions.MSBuild.Sdk.Copyrighting --version 0.8.35
#r "nuget: VDimensions.MSBuild.Sdk.Copyrighting, 0.8.35"
#:package VDimensions.MSBuild.Sdk.Copyrighting@0.8.35
#addin nuget:?package=VDimensions.MSBuild.Sdk.Copyrighting&version=0.8.35
#tool nuget:?package=VDimensions.MSBuild.Sdk.Copyrighting&version=0.8.35
VDimensions.MSBuild.Sdk.Copyrighting
Ensures that the project's copyright information, the assembly copyright information that is built into the output dll files, and the copyright information of the nuget package are aligned.
The Problem
MSBuild uses separate properties to express the same infomation:
| Property | Purpose |
|---|---|
$(Authors) |
Authors of the package, part of the nuget package properties |
$(Company) |
The company that produces the binaries, part of the nuget package properties |
$(AssemblyCompany) |
Embedded in the binary output of the project |
$(AssemblyCopyright) |
Embedded in the binary output of the project, expresses a copyright notice |
It is up to the developer to specify each these by hand, and most people often overlook them.
There is no sensible fallback that allows one to define only $(Company), and expect that $(AssemblyCompany) assumes the same value.
To MSBuild those are separate properties.
Developers have to know what is the purpose of each properties and to provide all of them in order to configure their projects correctly.
The Solution
This package adds an MSBuild target that would align these 4 properties in the following way:
- Unless explicitly set,
$(Company)will assume the value of$(Authors) - Unless explicitly set,
$(AssemblyCompany)will assume the value of$(Company). This will take into account the previous step, so if both$(Company)and$(AssemblyCompany)were not defined, they will now assume the value of$(Authors)
In addition to the above rules, this package will auto-evaluate $(AssemblyCopyright) if not provided by your project as follows.
- First, it will evaluate the current year. This happens during the build phase of your project, so it is the real-time year of your build. This will be stored in a custom
$(CopyrightYearCurrent)property. - It will look for a
$(CopyrightYearSince)property - that is a custom property that package authors might want to include, but it is completely optional. - Evaluates a temporary
$(_CopyrightYear)property that looks like this:
$(CopyrightYearSince)-$(CopyrightYearCurrent)if both properties are present$(CopyrightYearCurrent)if$(CopyrightYearSince)was not set.$(CopyrightYearCurrent)is automatically evaluated, but package authors could specify it by hand and override the auto-generated value.
- Combines the other copyright metadata into a single copyright notice expression, that takes the following form:
Copyright © $(Company) $(_CopyrightYear)
Examples
Authors only
| Property | Value |
|---|---|
$(Authors) |
MyGreatCompany |
$(CopyrightYearCurrent) |
2026 |
Result
| Property | Purpose |
|---|---|
$(Authors) |
MyGreatCompany |
$(Company) |
MyGreatCompany |
$(AssemblyCompany) |
MyGreatCompany |
$(AssemblyCopyright) |
Copyright © MyGreatCompany 2026 |
Authors and year since
| Property | Value |
|---|---|
$(Authors) |
MyGreatCompany |
$(CopyrightYearSince) |
2010 |
$(CopyrightYearCurrent) |
2026 |
Result
| Property | Purpose |
|---|---|
$(Authors) |
MyGreatCompany |
$(Company) |
MyGreatCompany |
$(AssemblyCompany) |
MyGreatCompany |
$(AssemblyCopyright) |
Copyright © MyGreatCompany 2010-2026 |
Authors, company and year since
| Property | Value |
|---|---|
$(Authors) |
MyGreatCompany |
$(Company) |
MyGreatCompany inc. |
$(CopyrightYearSince) |
2010 |
$(CopyrightYearCurrent) |
2026 |
Result
| Property | Purpose |
|---|---|
$(Authors) |
MyGreatCompany |
$(Company) |
MyGreatCompany inc. |
$(AssemblyCompany) |
MyGreatCompany inc. |
$(AssemblyCopyright) |
Copyright © MyGreatCompany inc. 2010-2026 |
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.