Nuget 1.3: some observations

I’m testing out a lot of features from NuGet for extending our software factory. In this testing I made the following observations:

  • Tools\Init.ps1 is only executed if the Content folder contains a file [See: http://nuget.codeplex.com/discussions/257282#post611456]
  • Tools\Install.ps1 is executed AFTER Tools\Init.ps1
  • If you have an empty solution without projects and install a package then the Tools\Init.ps1 is executed, but Tools\Install.ps1 is NOT executed
  • Tools\Install.ps1 is executed when a package is installed for a specific project
  • The $project parameter is always $null in Tools\Init.ps1
  • Don’t use the nuget.config file to configure your packages folder, it is an undocumented experimental feature which results in unexpected behaviour
  • Packages are installed at the solution level in a folder packages next to your solution file (.sln file)
  • Each project that has packages installed writes these installed packages and the installed packages it depends on in a packages.config file that is located in the project folder next to the project file (for example .csproj file)
    <?xml version="1.0" encoding="utf-8"?>
    <packages>   <package id="EntityFramework" version="4.1.10331.0" />   <package id="T4Scaffolding" version="1.0.0" />   <package id="MacawSolutionsFactory-Core" version="1.0.0" />   <package id="MacawSolutionsFactory-Spf2010" version="1.0.0" />
    </packages>
  • The packages folder contains a file repositories.config referencing the packages.config files of all projects in the solution that has packages installed
    <?xml version="1.0" encoding="utf-8"?>
    <repositories>   <repository path="..\srcfactory\Core\packages.config" />   <repository path="..\srcfactory\Spf2010\packages.config" />
    </repositories>
  • The repositories.config and packages.config files are used for “reference counting” packages. If uninstall-package is executed on a package, and there is no more packages.config file containing the package, the package folder is removed from the packages folder
  • The parameter $installPath points to the folder where the package is installed
  • The parameter $rootPath points to the Tools folder in the  folder where the package is installed
  • The parameter $package is a package object describing information about the package. To see the values of the properties add the code $package | format-custom –depth 1 to your Init.ps1/Install.ps1/Uninstall.ps1.
  • The parameter $project is an EnvDTE Project object ($null in Tools\Init.ps1, this script is executed at the solution level)
  • Uninstall-package removes a package, but does not automatically cascade delete the packages that were installed because the package was depending on these packages. Use the parameter –RemoveDependencies to do this
  • Scaffolders (see T4Scaffolding package for more info) are only available in the project where the package containing the scaffolders in installed. To have access to the scaffolders in all projects, add the project at the solution level
  • A package can’t be installed at the solution level using the install-package command, use the command-line NuGet.exe tool to do this
  • A good place for more information on how to create packages, what the parameters mean, etc is http://nuget.codeplex.com/documentation?title=Creating%20a%20Package
  • NuGet is a very active open source project with a lot of great discussions on http://nuget.codeplex.com/discussions

    You can execute the command Install-Package NuGetPSVariables to validate some of the above observations.

    UPDATE 1:

    • Great NuGet documentation on http://docs.nuget.org (uses open source MarkDown based documentation system: http://nugetdocs.codeplex.com) [Thanks Cyriel!]
    • No files required in Content folder for Init.ps1 to run
    • If a project is removed from a solution (and not deleted from the filesystem) the packages.config file in the removed project is still referenced in the packages\repositories.config file. It is now not possible to remove a package at solution level that is also referenced by the removed project. Delete the removed project from the filesystem to solve this issue.
    • Add the packages.config files in your project folders to your Visual Studio project (Show hidden files on project, Include in project) and include in source control. Set the build action to none otherwise the file could be included in the project output [Thanks Marino!]
    • Add the packages folder to source control (or at least the packages\repositories.config file)

    UPDATE 2:

    • When a solution is loaded the script Tools\Init.ps1 of all packages is executed. In execution of the Init.ps1 scripts the package dependencies are respected. So if package A depends on package B, the script B\Tools\Init.ps1 is executed before script A\Tools\Init.ps1.

    UPDATE 3:

    • When a package is installed, the Tools folder is added to the PATH environment variable ($env:PATH) with process scope, so scripts and applications in the tools folder can be directly executed from the NuGet console. Note that if you uninstall the package, the Tools folder of the uninstalled package in NOT removed from the PATH. When the package is installed again, the Tools folder is added to the again, so it appears twice in the PATH.

    Published Thursday, May 12, 2011 1:04 AM by svdoever

    Comments

    Thursday, May 12, 2011 5:21 AM by Marino van der Heijden

    # re: Nuget 1.3: some observations

    Hi Serge.

    Great article and research! My two pennies, the packages.config file has it's build action set to "content" by default. So it can get included in your project if you're using the default publishing & packaging tooling. I've set it to build action "none".

    Thursday, May 12, 2011 2:32 PM by Serge van den Oever [Macaw]

    # re: Nuget 1.3: some observations

    Hi Marino, thanks for your comment. Added your info to the list.

    Friday, May 13, 2011 2:15 AM by haacked

    # re: Nuget 1.3: some observations

    Hey Serge, this is great. Would you be interested in helping us update our existing documentation with this information? If you're familiar with Mercurial, you just need to clone our repository at http://nugetdocs.codeplex.com/, make the changes, and then issue a pull request.

    If not, I'll eventually do it myself. :)

    Friday, May 13, 2011 6:05 PM by svdoever

    # re: Nuget 1.3: some observations

    Hi Haacked, not familiar with Mercurial, but I will try it.

    Saturday, May 14, 2011 7:25 PM by Maarten

    # re: Nuget 1.3: some observations

    It seems that only packages that are library references end up in the packages.config and repositories.config.

    Packages containing only tools are somehow not included. I.e., the NuGet.Console package is never added to the repositories.config file as far as I can see.

    Sunday, May 15, 2011 11:04 AM by svdoever

    # re: Nuget 1.3: some observations

    @Maarten, you probably mean NuGet.CommandLine. This is a chocolatey package, and these packages are currently not tracked. This is a pity, because it would enable fast update of a development environment if we could check if a installed with chocolatey is up to date. See the discussion at nuget.codeplex.com/.../257341 related to keeping track of already installed chocolatey packages. This resulting in  the following chocolatey issue: github.com/.../22

    Monday, May 16, 2011 4:31 PM by svdoever

    # re: Nuget 1.3: some observations

    @Maarten: mistake, there is also a NuGet package  NuGet.CommandLine. The package thatot registered in the  is installed at the solution level because it has no library references (no lib folder). Solution packages are not registered in the repositories.config or the packages.config files.

    Saturday, August 13, 2011 10:00 AM by BernieR

    # re: Nuget 1.3: some observations

    hay un anГЎlogo parecido?

    http://www.webddlworld.com/

    BernieR

    Tuesday, November 29, 2011 1:56 AM by Professional Resume Editors

    # re: Nuget 1.3: some observations

    I really appreciate your proficient approach. These are pieces of very useful information that will be of great use for me in future.

    Sunday, September 23, 2012 1:24 AM by icons pack

    # re: Nuget 1.3: some observations

     Yes well!

    <a href="www.hpixel.com/.../a>

    Monday, September 24, 2012 8:10 AM by icons downloads

    # re: Nuget 1.3: some observations

     What necessary phrase... super, magnificent idea

    <a href="www.hpixel.com/.../a>

    Friday, October 05, 2012 12:28 AM by icons collection

    # re: Nuget 1.3: some observations

    <a href="www.yyware.com/.../by-71-navigation-icon-set-21204.html"> Completely I share your opinion. It seems to me it is good idea. I agree with you.</a>

    Monday, October 08, 2012 2:10 PM by icon designs

    # re: Nuget 1.3: some observations

    <a href="www.downloadready.com/.../download_109395.htm"> I am final, I am sorry, would like to offer other decision.</a>

    Friday, October 26, 2012 3:45 PM by cheap headphones

    # re: Nuget 1.3: some observations

    Some  truly   wonderful info  ,  Gladiolus  I found  this. "Nice guys finish last, but we get to sleep in." by Evan Davis.

    cheap headphones www.headphonesamazon.com

    Thursday, December 13, 2012 2:05 PM by icon design

    # re: Nuget 1.3: some observations

    P.S. Please review our <a href="http://sdk.militarydesign.biz">design portfolio</a> for Doors2012.

    iPhone and iPad Application Development - Designing App Icons

    2010 has seen a sudden upsurge in the market of Mobile iOS devices. There astronomical rise in the sales of iPhones and iPads. The Apple Application Store is directly accessible to the iPhone, iPad and iPod devices that run on the iOS.When any iOS designer submits the mobile application, he/she has to also submit the icon along with it. The process of developing an icon could consume a bit of time but its returns are handsome too.There are different icons each having different size and used for specific purpose. There are different devices that run the iOS. This implies that the application designer has to know which sort of icon is to be used when and how.Icon sizes for iPhone /iPod applications:The Icon sizes for Application, iPhone 4, App Store, Spotlight Search and iPhone 4 spotlights are 57x57px, 114x114px, 512x512px, 29x29px and 58x58px respectively.There are not many variations in the icon sizes for iPhone appliactions. The size of the official application icon which is displayed on the home screen of the user is 57x57px. Higher resolution is also supported by the iPhone 4 so it is better to include the icon with size 114x114px, though not necessary.The largest icon size that is recommended is 512 x 512px. This icon is quite big. This icon is meant for being displayed over the App Store as well as when the visitor is browsing the applications in Cover Mode. When you start a new icon design with the help of the Photoshop it is better to start initially at 512px and then slowly decreasing the scale.Icons with a bit smaller size of 29Г—29px are supported for Spotlight search. The iPhone 4 features screen with higher resolutions and because of this the icon size for spotlight search should be 58Г—58px.Icon sizes for iPad applications:The Icon sizes for iPad Application, App Store, Spotlight Search and Settings are 72x72px, 512x512px, 50x50px, and 29x29px respectively.The touch screen of the iPad is comparatively larger than that of the iPhone or iPod. This allows the application icon to be a bit larger. It is 72x72px. The size of the App Store Icon which is 512x512px is the same as in the case of iPhone. The icon size for Spotlight Search is 50x50px. The icon of the size 29x29px can be used as a setting icon.A small icon will be displayed beside the tab if a settings page is created within the general functionality of the iOS. This allows inclusion of different user names and accounts and change of themes too. The smaller or minor options of the application can also be fiddled with because of this arrangement.The application developer should also note that the applications that offer icons in PNG files are only accepted by the Apple App Store.Copyright В© 2011

    Monday, January 21, 2013 4:58 AM by Kepnuandhep

    # re: Nuget 1.3: some observations

    This web webpage is certainly a walk-through for all of the information you wanted about this and didn't know who to ask. Glimpse here, and you'll absolutely discover it.

    [url=cheapnfljerseys168.22web.org]NFL Jerseys[/url]

    Thursday, January 24, 2013 5:24 AM by immimaArrolow

    # re: Nuget 1.3: some observations

    I discovered your blog webpage on google and check some of your early posts. Continue to maintain up the very superior operate. I just further up your RSS feed to my MSN News Reader. Looking for forward to reading far more from you later on!

    [url=airjordanjc.webstarts.com]jordans cheap[/url]

    Friday, February 01, 2013 2:50 PM by fierrexBish

    # re: Nuget 1.3: some observations

    especially nice post, i absolutely love this web site, keep on it

    [url=www.shopmichaelkorshanbags.com]michael kors bags sale[/url]

    Friday, February 01, 2013 3:47 PM by Kepnuandhep

    # re: Nuget 1.3: some observations

    Spot on with this write-up, I truly think this web-site needs far more consideration. I'll possibly be once again to read far more, thanks for that info.

    [url=cheapnfljerseys168.mydiscussion.net]wholesale nfl jerseys[/url]

    Wednesday, February 06, 2013 10:41 PM by JeobreLourb

    # re: Nuget 1.3: some observations

    Many marijuana users say they can "take it or leave it" Superintendent DNA Marijuana it use legal with certain restrictions and guidelines. Stepmom Is it ok for medicinal marijuana dispensaries structure spiritual get parts natural hazy as its been ever since.  [url=vaporizerworld.org/best-vaporizer]vaporizer[/url]  However, because different strains of marijuana have different passion US any have medical marijuana is by in most places.   Having Angeles marijuana dispensaries to serve people  As the an been together with good ventilation and separate ballast.

    Saturday, February 09, 2013 10:12 PM by nsgwolhgqv@gmail.com

    # re: Nuget 1.3: some observations

    Thanks, this really is the worst thing I¡¯ve study プラダ キーケース http://www.bagsforjapan.com/

    Monday, February 11, 2013 4:53 PM by fierrexBish

    # re: Nuget 1.3: some observations

    I was very pleased to get this web-site.I wanted to thanks for your time for this marvelous read!! I surely enjoying just about every small bit of it and I have you bookmarked to take a look at new stuff you blog post.

    [url=www.michaelkorsdiscountbag.com]michael kors bags outlet[/url]

    Monday, February 11, 2013 11:34 PM by fierrexBish

    # re: Nuget 1.3: some observations

    Spot on with this write-up, I really feel this website requirements a lot more consideration. I'll possibly be once more to read a lot more, thanks for that info.

    [url=www.michaelkorsbags4cheap.com]michael kors bags[/url]

    Monday, February 18, 2013 2:26 AM by Resume services

    # re: Nuget 1.3: some observations

    Good one, was to the mark , was very useful to my website

    Friday, February 22, 2013 3:15 AM by fierrexBish

    # re: Nuget 1.3: some observations

    This is the perfect weblog for any person who desires to discover about this topic. You comprehend so significantly its virtually difficult to argue with you (not that I in fact would want?-HaHa). You certainly put a brand new spin on a subject thats been written about for years. Good stuff, just good!

    [url=http://www.bagsmkoutlet.com]michael kors bag[/url]

    Sunday, March 03, 2013 5:44 AM by fierrexBish

    # re: Nuget 1.3: some observations

    I'm impressed, I must say. Seriously rarely do I encounter a blog that is both educative and entertaining, and let me tell you, you might have hit the nail on the head. Your notion is outstanding; the concern is something that not sufficient people today are speaking intelligently about. I am pretty happy that I stumbled across this in my search for some thing relating to this.

    [url=www.salesmichaelkorsbag.com]michael kors bags outlet[/url]

    Monday, March 11, 2013 8:24 PM by fierrexBish

    # re: Nuget 1.3: some observations

    It's tough to find knowledgeable many people on this subject, but you sound like you know what you are talking about! Thanks

    [url=www.newmichaelkors2013.com]michael kors bags sale[/url]

    Thursday, March 21, 2013 6:05 PM by lhnhuiemvh@gmail.com

    # re: Nuget 1.3: some observations

    Hello! I simply want to offer you a huge thumbs up for the excellent information you have right here on this post. I will be coming back to your site for more soon.

    Tuesday, April 16, 2013 6:17 AM by Laplante

    # re: Nuget 1.3: some observations

    When some one searches for his necessary thing, therefore he/she wishes to be available that in

    detail, thus that thing is maintained over here.

    Leave a Comment

    (required) 
    (required) 
    (optional)
    (required)