When I build from Visual Studio, in post-build I run the PowerShell script from MSBuild using the PowerShell MSBuild task ( http://powershellmsbuild.codeplex.com/ ). In this PowerShell code, I would like to add / modify elements to my project using Visual Studio automation (via an EnvDTE object).
Exact case:
For each X.asmx file in my project, I need to add the Xwsdl.aspx and Xdisco.aspx files that do not need to be compiled. I want to do this only if these files are not already created, or if the asmx file is newer than the current Xwsdl.aspx and Xdisco.aspx files. If you are wondering why I need these additional files: this is a SharePoint thing.
Addition:
The following PowerShell code is simply added to the executed script:
$ process = [System.Diagnostics.Process] :: GetCurrentProcess () Write-Host "Process name: $ ($ a.ProcessName)"
What returns:
Process Name: devenv
This means that msbuild runs in the context of the Visual Studio process.
source
share