Using the nupack Package Manager Console to install a working folder in the solutions folder

In Visual Studio, nupack adds a shell window called the package manager console. I think this will be a good place to run version control commands (I use Mercurial). However, the default working directory is my folder for users, so I need to go to the folder with the code every time I load a new project.

I am wondering if there is one line for installing the working directory in the solutions folder. for example, does something like this exist?

cd $SolutionFolder 

From the results of get-variable it does not look like there is something immediately available, but I have never used powershell before, so maybe there is a way to get the solution folder?

+6
powershell nuget
source share
3 answers

Thanks to Doug for pointing me in the right direction. I wrote full instructions on my blog:

http://mark-dot-net.blogspot.com/2010/10/change-to-solution-folder-in-package.html

The main answer is as follows:

 Split-Path -parent $dte.Solution.FileName | cd 

To make it more accessible, you need to create a function in the "user profile" script file, whose location is in the $profile variable. You will need to create a file if it does not exist. Then add the function:

 Function solutionFolder() { Split-Path -parent $dte.Solution.FileName | cd } 

Now, after loading the solution into VS2010, you can simply enter:

 solutionFolder 

and the working folder will be changed.

+4
source share

Try

 $dte.Solution.FileName 
+2
source share

I'm not sure when it changed, but the package manager console automatically switches the working directory to the current solutions folder when you open the application.

+1
source share

All Articles