Search code examples
powershellnugetnuspec

How to delete files a dependency installed after your package is installed


I'm working on a nuget package that depends on the Unity and Unity.Mvc4 packages. My nuspec file has them listed as dependencies. Everything works, but when my package is installed the dependencies are installed first.

The Unity dependencies deploy files to the root of the project that my package has moved to a different location and customized, as such I don't want those files to exist in the root after my package is installed.

Is there any way to override dependency files in nuspec, or run a powershell script after install to clean them up?


Solution

  • You might add a Powershell script that move those files created by Unity to your actual project root.

    For information about executing Powershell scripts during Nuget package installation, see the Nuget documentation. Note that these scripts must be placed within the tools folder of your Nuget package to be automatically executed.