Git Product home page Git Product logo

vsts-nuget-bootstrapper's Introduction

Bootstrap a development environment for use with Visual Studio Team Services Package Management

Background

Microsoft.VisualStudio.Services.NuGet.Bootstrap provides a set of tools and scripts that makes it easy to set up a development environment that uses VSTS Package Management.

Much like the "Visual Studio Developer Prompt" makes it easy to interact with MSBuild, Microsoft.VisualStudio.Services.NuGet.Bootstrap creates a development environment that makes it easy to always have the latest package management tools, perform authentication, and use feeds.

Why use it?

  1. Users don't need to have nuget.exe installed and on their path. The environment automatically fetches and uses the latest supported NuGet tooling.
  2. Users don't need to manually configure credentials. When initializing their development environment, the tooling automatically obtains authentication tokens if necessary.
  3. Restore tool packages automatically during init. The environment can easily be configured to download and configure tool packages (i.e. build/test tools), to help make your development environment self contained.
  4. Self-updating. By running a simple command, or optionally enabling auto-update, you'll always have the latest package management tools.

How to use it?

  • After following the Get started steps below, developers simply run "init.ps1" or "init.cmd" in a prompt when starting their work.

Get started

There are multiple ways to get started, depending on your needs.

From a sample repository

If you want to start from an existing example, or just play around, you can start from an existing sample repository.

First, clone the sample repo. Then, change directories into the repo, and run init.cmd (CMD) or init.ps1 (Powershell). That's it!

  • If you're cloning from the command line, you may need to set up alternate credentials or use a personal access token.
  • You should see output similar to the following:
    d:\repos>git clone https://github.com/Microsoft/vsts-nuget-sample.git
    Cloning into 'vsts-nuget-sample'...
    Unpacking objects: 100% (41/41), done.
    Checking connectivity... done.
    
    d:\repos>cd vsts-nuget-sample
    
    d:\repos\vsts-nuget-sample>init.cmd
    Ensuring that NuGet is up to date... Updated NuGet
    Ensuring that you have credentials for VSTS package sources...
    Already have credentials for NuGet.Bootstrap.Sample.
    ...
  • You can now modify the sample repository and make it your own.

From the command line (new or existing project)

  1. Open a PowerShell prompt and cd into the root of your repository.

  2. Download nuget.exe from https://dist.nuget.org/win-x86-commandline/latest/nuget.exe. You can run ``Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile nuget.exe``` in PowerShell.

  3. Run the command <path_to_nuget.exe> install -OutputDirectory packages Microsoft.VisualStudio.Services.NuGet.Bootstrap. You'll see:

    PS C:\projects\MyCoolProject> nuget install -OutputDirectory packages Microsoft.VisualStudio.Services.NuGet.Bootstrap
     Attempting to gather dependencies information for package 'Microsoft.VisualStudio.Services.NuGet.Bootstrap.0.0.1' with respect to project 'C:\projects\MyCoolProject', targeting 'Any,Version=v0.0'
     Attempting to resolve dependencies for package 'Microsoft.VisualStudio.Services.NuGet.Bootstrap.0.0.1' with DependencyBehavior 'Lowest'
     Resolving actions to install package 'Microsoft.VisualStudio.Services.NuGet.Bootstrap.0.0.1'
     Resolved actions to install package 'Microsoft.VisualStudio.Services.NuGet.Bootstrap.0.0.1'
     Adding package 'Microsoft.VisualStudio.Services.NuGet.Bootstrap.0.0.1' to folder 'packages'
     Added package 'Microsoft.VisualStudio.Services.NuGet.Bootstrap.0.0.1' to folder 'packages'
     Successfully installed 'Microsoft.VisualStudio.Services.NuGet.Bootstrap 0.0.1' to packages
  4. Run the command .\packages\Microsoft.VisualStudio.Services.NuGet.Bootstrap.*\tools\Bootstrap.ps1 to bootstrap and initialize your environment. You'll see:

    PS C:\project\MyCoolProject> .\packages\Microsoft.VisualStudio.Services.NuGet.Bootstrap.*\tools\Bootstrap.ps1
    The option -repoRoot was not specified, assuming current working directory
    Setting up the VSS Package Management environment...
    Setting up init.ps1 and init.cmd
    Looks like you don't have a nuget.config yet, so we'll create one for you
    Looks like you don't have a .gitignore yet, so we'll create one for you
    Updated your VSS.PackageManagement environment to version 0.0.1.  Please check in changes to source control.  Now running init.ps1 to put you into the updated environment...
    Ensuring that NuGet is up to date... Updated NuGet
    Ensuring that you have credentials for VSTS package sources...
    Already have credentials for VSS.PackageManagement.Bootstrap.

From an existing project in Visual Studio

Note: NuGet in Visual Studio 2015 currently requires a project to exist to install solution-level NuGet packages. If you'd like to use this method but don't yet have a project, create a project and then follow these steps.

  1. Open the project in Visual Studio 2015.

  2. Right click on the solution, and select "Manage NuGet Packages for Solution"

    Selecting "Manage NuGet Packages for Solution"

  3. Find the package Microsoft.VisualStudio.Services.NuGet.Bootstrap. Choose the latest version, and hit install. Installing Microsoft.VisualStudio.Services.NuGet.Bootstrap

  4. You should see output similar to the following: Install output

  5. You may notice that a packages.config was either created or modified in your project, containing the package "Microsoft.VisualStudio.Services.NuGet.Bootstrap". You can delete this file (or remove the entry for Microsoft.VisualStudio.Services.NuGet.Bootstrap) if you wish to prevent NuGet from restoring this package. That is, the packages.config entry and package itself is no longer required once your environment is set up, although it will not hurt anything. Project packages.config

Update

From the command line

To update your environment, simply run .\scripts\init\Update-Environment.ps1. This will find the latest version available, compare it to your version, and (after prompting) update to the new environment. You'll see:

PS C:\projects\MyCoolProject> .\scripts\init\Update-Environment.ps1
The option -repoRoot was not specified or was not found, assuming current working directory
Current version is 0.0.3
Newest version is 0.0.4
Update from 0.0.3 to 0.0.4? [y/n]: y
...

From Visual Studio

If you left a project-level packages.config with the package "Microsoft.VisualStudio.Services.NuGet.Bootstrap", you can use Visual Studio to update the environment. Simply use "Manage NuGet Packages for Solution" in the IDE to update the package.

Note that if you mix command-line updating with this method, the version "currently installed" by the IDE may not match the version actually installed.

Policy

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

vsts-nuget-bootstrapper's People

Contributors

emanuelquintero avatar infin8x-test avatar jascam avatar jmyersmsft avatar microsoft-github-policy-service[bot] avatar tadimsky avatar vtbassmatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vsts-nuget-bootstrapper's Issues

Unable to connect to the remote server

Since this morning I'm getting:
`
Installing package 'Microsoft.VisualStudio.Services.NuGet.CredentialProvider' to 'C:\Users\user\AppData\Local\Temp\Package-2018-03-22_11-29-28'.
Unable to load the service index for source https://nuget.org/api/v2/.
An error occurred while sending the request.
Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 191.236.146.247:443
WARNING: Failed to fetch updated CredentialProvider.VSS.exe from https://nuget.org/api/v2/
Microsoft.VisualStudio.Services.NuGet.CredentialProvider was not found at https://nuget.org/api/v2/
At C:\PROJECTS\test\scripts\scripts\init\Initialize-InstallFromNuget.ps1:23 char:9

  •     throw "$packageName was not found at $downloadFeed"
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Microsoft.Visua...get.org/api/v2/:String) [], RuntimeException
    • FullyQualifiedErrorId : Microsoft.VisualStudio.Services.NuGet.CredentialProvider was not found at https://nuget.org/api/v2/
      `

To solve this I have updated file \scripts\init\Initialize-NuGet.ps1 from:
$credProviderDownloadFeed = "https://nuget.org/api/v2/"
to:
$credProviderDownloadFeed = "https://api.nuget.org/v3/index.json"

Nuget feed in VSTS “Including description is not supported while including all versions.”

I created a nuget feed in my VSTS and I follow the instructions to push a package but I'm getting this error consuming it from Visual Studio:

"[CGPE.LogClient3] Failed to retrieve metadata from source 'https://cgpe.pkgs.visualstudio.com/_packaging/30074c7b-4682-48db-9c97-9afd15e93471/nuget/v3/query2/?q=&skip=0&take=26⪯release=false⊃portedFramework=native,Version=v0.0&semVerLevel=2.0.0'. Response status code does not indicate success: 500 (Internal Server Error - Including description is not supported while including all versions. (VSTS Activity ID: 1C80CF12-0FE0-4757-A230-1461A7C07A2F))."

Also, I get a "No packages found" performing a nuget list.

nuget list -Source https://cgpe.pkgs.visualstudio.com/_packaging/CGPE.LogClient3/nuget/v3/index.json Please provide credentials for: https://cgpe.pkgs.visualstudio.com/_packaging/CGPE.LogClient3/nuget/v3/index.json UserName: Vicente Password: ****************************************************
No packages found.

But the package is pushed

nuget.exe push -Source https://cgpe.pkgs.visualstudio.com/_packaging/CGPE.LogClient3/nuget/v3/index.json -ApiKey key "VSTS-HelloWorld\VSTS-HelloWorld 1.0.55.nupkg" Pushing VSTS-HelloWorld 1.0.55.nupkg to 'https://cgpe.pkgs.visualstudio.com/_packaging/30074c7b-4682-48db-9c97-9afd15e93471/nuget/v2/'...

PUT https://cgpe.pkgs.visualstudio.com/_packaging/30074c7b-4682-48db-9c97-9afd15e93471/nuget/v2/

Please provide credentials for: https://cgpe.pkgs.visualstudio.com/_packaging/CGPE.LogClient3/nuget/v3/index.json

UserName: Vicente 
Password:

Conflict https://cgpe.pkgs.visualstudio.com/_packaging/30074c7b-4682-48db-9c97-9afd15e93471/nuget/v2/ 14828ms

Response status code does not indicate success: 409 (Conflict - The feed already contains 'VSTS-HelloWorld 1.0.55'. (VSTS Activity ID: CD8E6A2A-2F0E-4F8C-8768-42EDCE269083)).

I can't find any information about this problem.

Thanks a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.