Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Run init.ps1 file after EACH NuGet installation

$
0
0

I have a C# NuGet project and I have created a tools\init.ps1 file in order to perform some actions directly after the installation of the NuGet. This file is embeded using the .nuspec file of the NuGet project.

The fact is that I discovered that the script isn't run after each installation, and I discovered that the only trigger which allows the script to be started is that the NuGet should be installed after the Visual Studio re-opening.

For example:

  • I open VS solution
  • I select the target project ('MyProject2') and install my NuGet
  • The script is successfully executed:
Added package 'MyProject.1.0.0' to folder 'C:\Users\xxxxx\Documents\Visual Studio 2019\Projects\MySolution\packages'Added package 'MyProject.1.0.0' to 'packages.config'Executing script file 'C:\Users\xxxxx\Documents\Visual Studio 2019\Projects\MySolution\packages\MyProject.1.0.0\tools\init.ps1'...Successfully installed 'MyProject 1.0.0' to MyProject2
  • I uninstall my NuGet in the project

Successfully uninstalled 'MyProject.1.0.0' from MyProject2

  • Install my NuGet again
  • The script isn't executed:
    Added package 'MyProject.1.0.0' to folder 'C:\Users\xxxxx\Documents\Visual Studio 2019\Projects\MySolution\packages'    Added package 'MyProject.1.0.0' to 'packages.config'    Successfully installed 'MyProject 1.0.0' to MyProject2

I don't find any way to run this script after every installation without restart Visual Studio. I have also tried to clear the NuGet cache before the uninstallation but the result is the same.

Is there any way, any option to activate, or something else, to be able to to that?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>