开发者

Adding scripts to a solution folder in visual studio with Nuget

开发者 https://www.devze.com 2023-03-02 15:17 出处:网络
I want to use nuget to distribute a set of shared build scripts for our projects, the way I envision it working is as follows:

I want to use nuget to distribute a set of shared build scripts for our projects, the way I envision it working is as follows:

  1. User runs install-package build.support
  2. Package is downloaded
  3. Build scripts appear in a solution folder in the solution along with a default 'top level' build script you can edit for your needs.

Now maybe nuget isn't the ri开发者_StackOverflow中文版ght tool for this and I should just be branching the build scripts directory into my project from somewhere else in the tree, but what I really want is a solution level package not a project level package. Is this possible out of the box?

One option is to use powershell to copy the files into the right place from a tools directory in the nuget package, but again, this feels like a hack.


This isn't possible without a "hack" such as your powershell scripts, as libraries are "installed" into packages, not solutions.

I don't think is an unreasonable request - I'd suggest posting it in the official NuGet discussion forums to see if others agree: http://nuget.codeplex.com/discussions


Yes, you can do this by placing your code in the init.ps1 file. install.ps1 only executes with project-level packages. Because the code will be in init.ps1, it will run every time the solution loads - not just at install. so you will need to safeguard against re-execution. See this post for a code example - You'll just need to add a step to copy from the tools folder to the solution folder.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号