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
Releasemode. - Add reference to
RedGate.SmartAssembly.MSBuildNuGet package. - Open SmartAssembly and:
- Choose assembly from Release folder as main assembly.
- Choose any location for destination assembly.
- Save the project next to
.csprojwith the same name.
Edit your
.csprojand add a new property:<PropertyGroup> ... <SmartAssemblyOverwriteAssembly>true</SmartAssemblyOverwriteAssembly> </PropertyGroup>
- Use
dotnet pack -c Releasecommand-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.