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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With