Create a Nuget package with .Net 5 to wrap a dll

December 3, 2020    .Net Nuget

Create a Nuget package with .Net 5 to wrap a dll

We’re transitioning to Git and wanting to get the dlls and exes out of our repository (before moving so that it doesn’t keep it in history for ever. See this video about Git LFS for details . Git Lfs seemed too complicated for our team right now).

I found the easiest way was to create a Nuget package with the dll and decided to use .Net 5 that just came out.


<Project Sdk="Microsoft.NET.Sdk">
		<Authors>Kevin Logan</Authors>
			This .dll has been in TFVC source control for a long time.
			This package wraps it so we can get it out before moving to Git.
			used dotnet build --configuration Release
			csproj Source is {here}
			nuget.exe push -Source "YourSource" -ApiKey AzureDevOps
		<Content Include="The.dll" Pack="true" PackagePath="lib\net5.0-windows7.0\" />
		<Content Include="The.dll" Pack="true" PackagePath="lib\net452\" />
		<Reference Include="The">
        <!-- maybe you need to include an old .Net 4.5 dll? I'm not sure this is the best practice-->
		<Reference Include="System.Web.Services">
			<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.Services.dll</HintPath>

creating the .nupkg

just run dotnet build --configuration Release (since true is in the csproj)

or dotnet pack --configuration Release

Upload to your Azure DevOps instance

Click the connect to feed button to see instructions on how to push packages to the repository 1. Download the nuget.exe 2. Copy it to your directory 3. In the command line 4. nuget.exe sources Add -Name “YourSource” -Source “{azdo url}/_packaging/Omnia360Suite/nuget/v3/index.json” 5. nuget.exe push -Source “YourSource” -ApiKey AzureDevOps my_package.nupkg a. nuget.exe push -Source “YourSource” -ApiKey AzureDevOps {prefix}* (* works)

Azure DevOps Artifacts Docs

Watch the Story for Good News
I gladly accept BTC Lightning Network tips at [email protected]

Please consider using Brave and adding me to your BAT payment ledger. Then you won't have to see ads! (when I get to $100 in Google Ads for a payout, I pledge to turn off ads)

Use Brave

Also check out my Resources Page for referrals that would help me.

Swan logo
Use Swan Bitcoin to onramp with low fees and automatic daily cost averaging and get $10 in BTC when you sign up.