Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the NuGet output directory through PowerShell?

I need to write NuGet package install.ps1 script that will copy native dll files to output directory, but I can't find the way to get the output folder path.

I think the solution is to use something like the following:

$solutionDir = [System.IO.Path]::GetDirectoryName($dte.Solution.FullName) + "\"

How can I get the output directory path through PowerShell?

like image 294
AlonFStackoverflow Avatar asked Jan 30 '26 17:01

AlonFStackoverflow


1 Answers

By "output directory" do you mean output directory for a project? If so, you can iterate through the projects to find one by index and then grab the project's base dir like so (assuming you've determined the project you're interested in is at index 3:

 $project = $dte.Solution.Projects.Item(3)
 ($project.Properties | Where Name -match FullPath).Value

Then to get the build path (bin\debug or bin\release) you do this:

($project.ConfigurationManager.ActiveConfiguration.Properties | Where Name -match OutputPath).Value

You can also access the active project in the solution like so:

 $project = $dte.ActiveSolutionProjects
like image 172
Keith Hill Avatar answered Feb 02 '26 13:02

Keith Hill