Support for adding code snippets / VSIX

Nov 5, 2010 at 11:17 AM

How can I distribute code snippets along with a nuget package?

I would very much like to at least offer the end-user the option of installing the snippets when the package is installed. Is this possible, or is it at least on the radar?

Nov 5, 2010 at 12:51 PM
snippets are not even supported by the VSIX extension mechanism.

although it would be feasible by just copying the snippet files to the user's profile.

nuget doesn't need to do anything special there: just provide an initialization script (powershell) that does the copying and deleting on uninstall.

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Fri, Nov 5, 2010 at 07:17, maranite <notifications@codeplex.com> wrote:

From: maranite

How can I distribute code snippets along with a nuget package?

I would very much like to at least offer the end-user the option of installing the snippets when the package is installed. Is this possible, or is it at least on the radar?

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 15, 2010 at 4:57 PM
I finally got around to doing it and blogging it :)

How to create lightweight reusable source code with NuGet: http://kzu.to/dRWCOt

Easy deploy of code snippets with your nuget.

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Fri, Nov 5, 2010 at 08:51, Daniel Cazzulino <kzu@clariusconsulting.net> wrote:
snippets are not even supported by the VSIX extension mechanism.

although it would be feasible by just copying the snippet files to the user's profile.

nuget doesn't need to do anything special there: just provide an initialization script (powershell) that does the copying and deleting on uninstall.

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471



On Fri, Nov 5, 2010 at 07:17, maranite <notifications@codeplex.com> wrote:

From: maranite

How can I distribute code snippets along with a nuget package?

I would very much like to at least offer the end-user the option of installing the snippets when the package is installed. Is this possible, or is it at least on the radar?

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com



Coordinator
Dec 15, 2010 at 4:59 PM

Very cool! J

From: dcazzulino [email removed]
Sent: Wednesday, December 15, 2010 8:58 AM
To: Phil Haack
Subject: Re: Support for adding code snippets / VSIX [nuget:233611]

From: dcazzulino

I finally got around to doing it and blogging it :)

How to create lightweight reusable source code with NuGet: http://kzu.to/dRWCOt

Easy deploy of code snippets with your nuget.


/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471

On Fri, Nov 5, 2010 at 08:51, Daniel Cazzulino <kzu@clariusconsulting.net> wrote:

snippets are not even supported by the VSIX extension mechanism.

although it would be feasible by just copying the snippet files to the user's profile.

nuget doesn't need to do anything special there: just provide an initialization script (powershell) that does the copying and deleting on uninstall.

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471



On Fri, Nov 5, 2010 at 07:17, maranite <notifications@codeplex.com> wrote:

From: maranite

How can I distribute code snippets along with a nuget package?

I would very much like to at least offer the end-user the option of installing the snippets when the package is installed. Is this possible, or is it at least on the radar?

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Dec 15, 2010 at 5:11 PM
The code samples on your blog are missing all the angle-bracket content. :(
Dec 15, 2010 at 5:14 PM
you mean someone actually wants to see angle brackets? :P

damn old deprecated blog engine setup.... fixing it now...

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Wed, Dec 15, 2010 at 14:11, BradWilson <notifications@codeplex.com> wrote:

From: BradWilson

The code samples on your blog are missing all the angle-bracket content. :(

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 15, 2010 at 5:35 PM
fixed!

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Wed, Dec 15, 2010 at 14:13, Daniel Cazzulino <kzu@clariusconsulting.net> wrote:
you mean someone actually wants to see angle brackets? :P

damn old deprecated blog engine setup.... fixing it now...


/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Wed, Dec 15, 2010 at 14:11, BradWilson <notifications@codeplex.com> wrote:

From: BradWilson

The code samples on your blog are missing all the angle-bracket content. :(

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com



Dec 15, 2010 at 8:13 PM

One small downside is that the package installation is for one solution, while the snippets are machine wide.  Suppose you do:

  • Install your package in proj 1: snippets get copied
  • Install your package in proj 2: snippets get copied again (no op)
  • uninstall package from proj 2: snippets get deleted
  • Now proj 1 doesn't have access to the snippets

We would really want the snippets to be local to the solution, but I'm not sure there is such thing.

Dec 15, 2010 at 8:40 PM

There is no such a thing, unfortunately

from android nexus1

On Dec 15, 2010 5:13 PM, "davidebbo" <notifications@codeplex.com> wrote:
> From: davidebbo
>
> One small downside is that the package installation is for one solution, while the snippets are machine wide. Suppose you do:Install your package in proj 1: snippets get copied Install your package in proj 2: snippets get copied again (no op) uninstall package from proj 2: snippets get deleted Now proj 1 doesn't have access to the snippets We would really want the snippets to be local to the solution, but I'm not sure there is such thing.
>
>
Dec 15, 2010 at 10:11 PM
I'd say it's not a big deal anyway, as re-installing it will simply be no-op (binaries & references wise), but will add the snippets again.

I thought about some "reference-counting" kind of mechanism, but that would be complex with little added value, really.

Alternatively, if NuGet had a hook on solution open, I could hookup my script to check for the presence of the snippet files automatically...

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Wed, Dec 15, 2010 at 17:40, Daniel Cazzulino <kzu@clariusconsulting.net> wrote:

There is no such a thing, unfortunately

from android nexus1

On Dec 15, 2010 5:13 PM, "davidebbo" <notifications@codeplex.com> wrote:
> From: davidebbo
>
> One small downside is that the package installation is for one solution, while the snippets are machine wide. Suppose you do:Install your package in proj 1: snippets get copied Install your package in proj 2: snippets get copied again (no op) uninstall package from proj 2: snippets get deleted Now proj 1 doesn't have access to the snippets We would really want the snippets to be local to the solution, but I'm not sure there is such thing.
>
>

Dec 15, 2010 at 10:52 PM

I don't think re-installing will work, as we'll detect that it's already there and do nothing at all.

But note that there is a hook at solution open: it's the tools\init.ps1 file.  This is used for example in the MvcScaffold package to add new commands to the environment.  You could probably do it from there.

Dec 15, 2010 at 11:12 PM
good to know. will give it a try.

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Wed, Dec 15, 2010 at 19:52, davidebbo <notifications@codeplex.com> wrote:

From: davidebbo

I don't think re-installing will work, as we'll detect that it's already there and do nothing at all.

But note that there is a hook at solution open: it's the tools\init.ps1 file. This is used for example in the MvcScaffold package to add new commands to the environment. You could probably do it from there.

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 15, 2010 at 11:20 PM
not seeing this too clear.

is there a naming convention there for the ps1 files?

- Install.ps1 : runs only on install
- Init.ps1: runs on every solution open?
- Uninstall.ps1: runs only on uninstall?

/kzu

--
Daniel Cazzulino | Developer Lead | MS MVP | Clarius Consulting | +1 425.329.3471


On Wed, Dec 15, 2010 at 19:52, davidebbo <notifications@codeplex.com> wrote:

From: davidebbo

I don't think re-installing will work, as we'll detect that it's already there and do nothing at all.

But note that there is a hook at solution open: it's the tools\init.ps1 file. This is used for example in the MvcScaffold package to add new commands to the environment. You could probably do it from there.

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 15, 2010 at 11:55 PM

Yes, you have it right.

Dec 16, 2010 at 8:45 PM

Please note that init.ps1 is also executed when the package is first installed in the solution (the first time the package is installed into any project within that solution).

Coordinator
Dec 20, 2010 at 9:38 PM

Just to follow-up and close the loop on this. We documented these special ps1 files in a section of our Creating Package docs entitled Automatically Running PowerShell Scripts During Package Installation and Removal