views:

272

answers:

3

I am trying to use Powershell to achive post build in Visual studio. I want to copy the appropriate dlls to the appropriate directories after the build based on the platform to which the assembly is targetted (i.e. x86 or x64). Does anyone know how to achieve this?

A: 
Richard
+2  A: 

You can use something like the following in the post-build event:

Powershell -File "$(SolutionDir)PostBuild.ps1" $(PlatformName)

The platform name can then be found in $args[0] inside the script (PostBuild.ps1).

Han
is this the only way you can use msbuild's properties (by setting parameters for the script)? aren't all msbuild properties available via the $env variable (or similar) somehow? (it seems not, but isn't there any other/easier way instead of giving each msbuild property in to the script via parameter?)
toebens
+1  A: 

Why not use Visual Studio's own custom build step? Seems odd to reinvent the wheel.

Alex