Giter Club home page Giter Club logo

vspowershelllib's Introduction

VsPowershellLib

A collection of powershell macros for Visual Studio.

Installing

  1. Clone the repository into %userprofile%\Documents\WindowsPowerShell:
    C:\> git clone https://github.com/aaubry/VsPowershellLib.git %userprofile%\Documents\WindowsPowerShell
    
  2. Restart Visual Studio or execute the following command inside Package Manager Console:
    PM> . "$($env:userprofile)\Documents\WindowsPowerShell\NuGet_profile.ps1"
    

Usage

Inside the Package Manager Console, execute the functions that are available inside the powershell files. When a function manipulates source code, the current type is the type that contains the location of the cursor in the currently open file.

Examples

Move the current type to a file named after that type

  1. Place the cursor inside the desired type.
  2. PM> Move-TypeToOwnFile

Add a constructor argument, a private field and initialize the field from the argument

  1. Place the cursor inside the desired type.
  2. PM> Add-Dependency IMyDependency

Delete a project configuration in every project in the solution

  1. PM> Get-Projects | % { $_.ConfigurationManager.DeleteConfigurationRow('PreRelease') }

Set the target framework of every project in the solution to .NET 4.5

  1. PM> Get-Projects | % { $_.Properties.Item("TargetFramework").Value = 262149 }

Downgrade a NuGet package to an older version

  1. Downgrade-Package SixPack 1.2.3

This will uninstall any installed package named 'SixPack' with a version number greater than '1.2.3'. And install that version instead.

Increment the package version number of the specified project and the minor version of all dependent packages

  1. Increment-PackageVersion MyProject Major
  2. Increment-PackageVersion MyProject Minor
  3. Increment-PackageVersion MyProject Build

This assumes that the package version is stored in a file named '_Package.cs' with the following structure:

internal static class Package
{
    public const string Name = "MyPackage";
	public const string Version_Major = "2";
	public const string Version_Minor = "1";
	public const string Version_Build = "0";
}

Update a NuGet package quickly

  1. PM> Update-PackageQuickly SixPack 1.2.36

This command is simmilar to the Update-Package command, except that it is much quicker to run. It does NOT perform the following:

  • Validate dependencies
  • Update dependent packages
  • Run install scripts

Use this command only if you know what you are doing.

vspowershelllib's People

Contributors

aaubry avatar

Stargazers

Daniel Correia avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

blinds52

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.