Archive

Posts Tagged ‘nuget’

Update NuGet.exe the easy way

September 21, 2013 Leave a comment

If you receive the following error, you must upgrade the nuget.exe included with chocolatey:

The schema version of 'NuGet.Server' is incompatible with version 2.1.31022.9038 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.

You can easily update nuget.exe by running the following:

%chocolateyinstall%\chocolateyinstall\nuget.exe update -self
Advertisements
Tags: ,

Part 5: Chocolatey: Creating a nupkg to distribute an installable package of an MSI

September 10, 2013 Leave a comment

Part 4: Chocolatey: Creating a nupkg to distribute an installable package in a EXE

September 9, 2013 Leave a comment

Part 3: Chocolatey: Creating a nupkg to distribute a portable package of a ZIPed EXE

September 9, 2013 Leave a comment

Debugging a chocolatey command

September 8, 2013 Leave a comment

Debugging a chocolatey operation is easy.

>chocolatey -debug install easy_install -source python
DEBUG: Running 'Chocolatey-Install' for easy_install with source: 'python', version: '', installerArguments:''
DEBUG: Running 'Chocolatey-Python' for easy_install with version:'', installerArguments: ''
DEBUG: Running 'Chocolatey-InstallIfMissing' for python with source:'', version: ''
DEBUG: Running 'Chocolatey-InstallIfMissing' for easy.install with source:'', version: ''
DEBUG: Running 'Chocolatey-Version' for easy.install with source:''.
DEBUG: Running 'Get-ConfigValue' with configValue:'useNuGetForSources'
DEBUG: Running 'Get-UserConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the user config the value of 'useNuGetForSources' is ''
DEBUG: Value not found in the user config file - checking the global config
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the global config the value of 'useNuGetForSources' is 'false'
DEBUG: Running 'Get-UserConfigValue' with configValue:'sources'
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'sources'
DEBUG: Using global sources
DEBUG: Using '-Source "http://chocolatey.org/api/v2/" -Source "https://go.microsoft.com/fwlink/?LinkID=230477" ' as the source arguments
DEBUG: based on: '-Source "http://chocolatey.org/api/v2/" -Source "https://go.microsoft.com/fwlink/?LinkID=230477" ' feed
DEBUG: Calling 'C:\Chocolatey\chocolateyinstall\nuget.exe' list "easy.install" -Source "http://chocolatey.org/api/v2/" -Source
"https://go.microsoft.com/fwlink/?LinkID=230477"  -NonInteractive
DEBUG: easy.install 0.6.11.4
DEBUG: "Sort-Object" - "python" cannot be found in "InputObject".
DEBUG: Long version of 0.6.11.4 is '000000000000.000000000006.000000000011.000000000004'
DEBUG: Running 'Chocolatey-NuGet' for easy.install with source:''. Force? False
Chocolatey (v0.9.8.20) is installing easy.install and dependencies. By installing you accept the license for easy.install and each dependency you are installing.
DEBUG: Installing packages to "C:\Chocolatey\lib".
DEBUG: Running 'Run-NuGet' for easy.install with source: '', version:''
DEBUG: ___ NuGet ____
DEBUG: Running 'Get-ConfigValue' with configValue:'useNuGetForSources'
DEBUG: Running 'Get-UserConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the user config the value of 'useNuGetForSources' is ''
DEBUG: Value not found in the user config file - checking the global config
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the global config the value of 'useNuGetForSources' is 'false'
DEBUG: Running 'Get-UserConfigValue' with configValue:'sources'
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'sources'
DEBUG: Using global sources
DEBUG: Using '-Source "http://chocolatey.org/api/v2/" -Source "https://go.microsoft.com/fwlink/?LinkID=230477" ' as the source arguments
DEBUG: Calling 'C:\Chocolatey\chocolateyinstall\nuget.exe' install easy.install -Outputdirectory "C:\Chocolatey\lib" -Source
"http://chocolatey.org/api/v2/" -Source "https://go.microsoft.com/fwlink/?LinkID=230477"  -NonInteractive
DEBUG: Installing 'easy.install 0.6.11.4'.
Successfully installed 'easy.install 0.6.11.4'.
DEBUG: Evaluating NuGet output for line: Installing 'easy.install 0.6.11.4'.
______ easy.install v0.6.11.4 ______
DEBUG: Running 'Delete-ExistingErrorLog' for easy.install
DEBUG: Looking for failure log at 'C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\failure.log'
DEBUG: Found the failure log. Deleting it...
DEBUG: Running 'Run-ChocolateyPS1' for easy.install with packageFolder:'C:\Chocolatey\lib\easy.install.0.6.11.4', action: 'install'
DEBUG:   __ PowerShell install (chocolateyinstall.ps1) __
DEBUG:   Looking for chocolateyinstall.ps1 in folder 'C:\Chocolatey\lib\easy.install.0.6.11.4'. If chocolateyinstall.ps1 is found, it
will be run.
DEBUG: Action file is 'chocolateyInstall.ps1'
DEBUG: Running 'C:\Chocolatey\lib\easy.install.0.6.11.4\tools\chocolateyInstall.ps1'
DEBUG: Running 'Install-ChocolateyPath' with pathToInstall:'C:\Python27'
DEBUG: Running 'Install-ChocolateyPath' with pathToInstall:'C:\Python27\Scripts'
Setting PYTHONHOME environment variable to 'C:\Python27'
PS: PYTHONHOME variable is not required to Python works, but it is a good practice to have it.
Using python home at 'C:\Python27'
Installing easy_install for Python(2.7.5)...
Installing setuptools from http://pypi.python.org/pypi/setuptools ...
DEBUG: Running 'Install-ChocolateyPackage' for easy.install/setuptools with
url:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe', args: '/S'
DEBUG: Running 'Get-ChocolateyWebFile' for easy.install/setuptools with
url:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe',
fileFullPath:'C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe',and
url64bit:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe'
DEBUG: Processor width is 64.
Downloading easy.install/setuptools (http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe) to C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe
DEBUG: Running 'Get-WebFile' for C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe
with url:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe', userAgent: 'chocolatey command line'
DEBUG: Setting the UserAgent to 'chocolatey command line'
Write-Error : easy.install/setuptools did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path 'C:\Users\Matt\AppData\Local\Temp\chocolatey\e
asy.install\setuptools\easy.install\setuptoolsInstall.exe'."
-----------------------
At C:\Chocolatey\chocolateyinstall\helpers\functions\Write-ChocolateyFailure.ps1:29 char:2
+     Write-Error $errorMessage
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Write-Error : easy.install did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path 'C:\Users\Matt\AppData\Local\Temp\chocolatey\e
asy.install\setuptools\easy.install\setuptoolsInstall.exe'."
-----------------------
At C:\Chocolatey\chocolateyinstall\helpers\functions\Write-ChocolateyFailure.ps1:29 char:2
+     Write-Error $errorMessage
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

new-object : Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path
'C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe'."
At C:\Chocolatey\chocolateyinstall\helpers\functions\Get-WebFile.ps1:82 char:18
+        $writer = new-object System.IO.FileStream $fileName, "Create"
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

You can use this on any of the chocolatey commands as the first argument:

chocolatey -debug install all -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug installmissing all -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug update all -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug uninstall 7zip
chocolatey -debug search easy_install 
chocolatey -debug list -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug version all -lo
chocolatey -debug webpi
chocolatey -debug windowsfeatures
chocolatey -debug cygwin
chocolatey -debug python
chocolatey -debug gem
chocolatey -debug pack
chocolatey -debug push
chocolatey -debug help
chocolatey -debug sources

Create your own nuget server to serve packages for Chocolatey

September 6, 2013 4 comments

Create a nupkg store:
1) Create a store:

mkdir c:\packagestore

2) Grab a few packages from the Chocolatey repo:

cd c:\packagestore
wget http://chocolatey.org/api/v2/package/spacesniffer/
wget http://chocolatey.org/api/v2/package/procmon/
wget http://chocolatey.org/api/v2/package/VirtualCloneDrive/

Create a nuget web repo:
1) Download visual studio 2012 express for web (try: `cinst VisualStudioExpress2012Web`).
2) Open Visual Studio 2012 Express for Web.
3) On the left pane, choose Template>your language> Web.
4) In the middle pane, select ASP.NET Empty Web Application, enter a name for your project and create new.
5) Go to Tools menu> Extensions and Updates.
6) On the left pane, choose Updates> update everything.
7) Go to Tools menu> Library Package Manager> Manage NuGet Packages for Solution…
9) On the left pane, choose Online>All
10) In the upper right, search for nuget.server and install into this project.

Configure and run the project:
1) In the source tree of the Solution Explorer pane, open web.config.
2) Search for “packagesPath” and set the value to “c:\packagestore”
3) Hit CTRL+F5 to build and run
4) You will be directed to localhost:1061

Update Chocolatey’s nuget:

%chocolateyinstall%\chocolateyinstall\nuget.exe update -self

Use Chocolatey to list and install packages from the source:
Listing works, but installing doesn’t. Not sure why now.

chocolatey list -source ""http://localhost:1601/nuget""
chocolatey install all -source ""http://localhost:1601/nuget""

Additionally, look at NuGet Gallery.

References:

Download, expand and review the contents of a nupkg

September 6, 2013 Leave a comment

1) Visit a nuget gallery and download the package. It will be accessible via a URL similar to:

mkdir c:\choco_dev && cd c:\choco_dev
wget http://chocolatey.org/api/v2/package/spacesniffer/1.1.4.0

2) Unzip the file:

7za x spacesniffer.*

3) Voila.

%d bloggers like this: