Process assemblies inside a NuGet package
Published 09 January 2020
SmartAssembly MSBuild task can be used to protect assemblies inside a NuGet package.
- Open your .NET Standard project in Visual Studio.
- Build it in
Release
mode. - Add reference to
RedGate.SmartAssembly.MSBuild
NuGet package. - Open SmartAssembly and:
- Choose assembly from Release folder as main assembly.
- Choose any location for destination assembly.
- Save the project next to
.csproj
with the same name.
Edit your
.csproj
and add a new property:<PropertyGroup> ... <SmartAssemblyOverwriteAssembly>true</SmartAssemblyOverwriteAssembly> </PropertyGroup>
- Use
dotnet pack -c Release
command-line command to create a NuGet package from your .NET Standard project (or use Publish/Pack option in Visual Studio). - The created .nupkg file will contain an obfuscated version of your assembly.