I've been scratching my head on this one for a while and cannot seem to find anything. I am trying to execute the following:
C:\Windows\Microsoft.NET\Framework\v3.5\MsBuild.exe D:\SourceFiles\Testing\AppaloosaDotNet\AppaloosaDotNet\AppaloosaDotNet.csproj "/t:_CopyWebApplication;ResolveReferences;publish" /p:ReferencePath=D:\Builds\Testing\LatestBuild\ /p:OutDir=\\ServerName\D$\WebContent\AppaloosaDotNET\bin\ /p:WebProjectOutputDir=\\ServerName\D$\WebContent\AppaloosaDotNET\
If I type this command directly into the PowerShell prompt it works fine. However I have created a PowerShell script that makes this call for me and when the script executes, MSBuild moves up one folder and uses the solution file (.sln) to build the project. This causes problems because the targets are not found in the solution file.
If I manually type the command and execute it MSBuild prints out it is building D:\SourceFiles\Testing\AppaloosaDotNET\AppaloosaDotNET\AppaloosaDotNET.csproj and the build is fine.
but if I run the script MSBuild prints out it is building D:\SourceFiles\Testing\AppaloosaDotNET\AppaloosaDotNET.sln and then the build fails because the targets are not found.
I'm sure I'm doing something wrong in my script but cannot figure out what. I have double checked to see that the command executed by the script is the same as I what I type. I even copied the command that is run when running the script and pasted at the prompt and it runs fine so I'm pretty sure the commands are the same. Any ideas?
Could your script be located at the same path as your solution? How exactly are you running your script and where does it reside (if it's not on the same path as solution)? It could be nothing but let's just confirm.