#How to richly enable a PowerShell script in a C# project to run in MSBuild
-
Open the .csproj file in Notepad++ (or, right-click the project, choose "Unload Project", then right-click it again and choose "Edit")
-
Paste the following before the
</Project>
tag at the end:<UsingTask TaskName="InvokePowerShell" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll"> <ParameterGroup> <ScriptFile ParameterType="System.String" Required="true" /> </ParameterGroup>