Skip Ribbon Commands
Skip to main content

Software Development Blog

Jun 21
Nuget Extension: Automatically copying package contents to projects output folder

In a project we are dynamically loading assemblies with MEF, we use Nuget to package the parts of our application.

This results in the scenario that we have references added to assemblies which are not needed to be referenced.

I've created the Nuget package Baseclass.Contrib.Nuget.Output to add the missing feature to nuget. It adds the possibility to have a folder called "output" in the root of the nuget package and automatically copies its contents to the projects output path.

Open source:


  1. Create a TestPackage (Tipp: Use PackageExplorer to create it) which has a test file in the output folder and depends on Baseclass.Contrib.Nuget.Output.

    <?xml version="1.0" encoding="utf-8"?>

    <package xmlns="">






    <description>My package description.</description>


    <dependency id="Baseclass.Contrib.Nuget.Output" />




    <file src="output\test.txt" target="output\test.txt" />



    and save it in C:\temp\temppackagesRepository.

  2. Create a new project in VisualStudio
  3. Add C:\temp\temppackagesRepository to the PackageSources (Options > Package Manager > Package Sources)
  4. Install the TestPackage
  5. Build the project.
  6. Take a look at debug folder: 


comments powered by Disqus

 ‭(Hidden)‬ Blogtools