I have added a code piece in my MS build file to run a powershell script. But while building it gives me a error error MSB4067: The element "Exec" beneath element "Project" is unrecognized.
Below is the code:
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe
</PowerShellExe>
<ScriptLocation Condition=" '$(ScriptLocation)'=='' ">
D:\Synopsis\SynopsysDetect.ps1
</ScriptLocation>
</PropertyGroup>
<Exec Command="%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -ExecutionPolicy Unrestricted -command ^"^& {^&'D:\Synopsis\SynopsysDetect.ps1'} ^"" />
Not sure if the issue is with code or have I placed the code piece at the wrong place. Any help would be appreciated. Thanks.
Moving the above piece of code completely into the "Target" tag fixed the issue.