Devlead.SourcePack
2026.6.23.3
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Devlead.SourcePack --version 2026.6.23.3
NuGet\Install-Package Devlead.SourcePack -Version 2026.6.23.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Devlead.SourcePack" Version="2026.6.23.3"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Devlead.SourcePack" Version="2026.6.23.3" />
<PackageReference Include="Devlead.SourcePack"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Devlead.SourcePack --version 2026.6.23.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Devlead.SourcePack, 2026.6.23.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Devlead.SourcePack@2026.6.23.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Devlead.SourcePack&version=2026.6.23.3
#tool nuget:?package=Devlead.SourcePack&version=2026.6.23.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Devlead.SourcePack
Opinionated MSBuild package for authoring source NuGet packages using standard SDK dotnet pack.
Features
- Ships
.csfiles undercontentFiles/cs/{tfm}/...withBuildAction=Compile - Optional
build/{tfm}/*.propsand*.targetsviaSourcePackFile - Per-target-framework dependencies from plain
PackageReferenceitems - No
lib/output (IncludeBuildOutput=falseby default) - Works with class libraries, console apps, and Azure Functions source projects
Installation
Add a development dependency to the project you want to pack:
<PackageReference Include="Devlead.SourcePack" PrivateAssets="all" />
Quick start
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<SourcePackRoot>Devlead/MyPackage</SourcePackRoot>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PackageReference Include="Devlead.SourcePack" PrivateAssets="all" />
<SourcePackFile Include="MyPackage.props" Kind="Build" />
<SourcePackFile Include="MyPackage.targets" Kind="Build" />
<SourcePackFile Include="../../README.md" Kind="Metadata" />
Pack in Release:
dotnet pack -c Release
For multi-target projects (TargetFrameworks), pack single-threaded to avoid duplicate contentFiles entries:
dotnet pack -c Release -- /m:1
Devlead.SourcePack sets BuildInParallel=false as an additional safeguard.
Properties
| Property | Default | Description |
|---|---|---|
EnableSourcePack |
true |
Opt out by setting false |
SourcePackRoot |
(required for auto sources) | Root folder under contentFiles/cs/{tfm}/ |
SourcePackPackConfigurations |
Release |
Configurations that pack sources |
SourcePackIncludeGeneratedUsings |
true |
Pack *.GlobalUsings.g.cs from obj/ |
SourcePackFile kinds
| Kind | Package path |
|---|---|
Source |
contentFiles/cs/{tfm}/{SourcePackRoot}/... |
Build |
build/{tfm}/{filename} |
Metadata |
package root (README, icon, etc.) |
Build
dotnet run --file cake.cs
Example projects
License
MIT
There are no supported framework assets in this package.
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.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.6.29.20 | 161 | 6/29/2026 |
| 2026.6.25.12 | 133 | 6/25/2026 |
| 2026.6.25.9 | 101 | 6/25/2026 |
| 2026.6.23.3 | 169 | 6/23/2026 |