title: MSBuild uses .sln when called from PowerShell script but .csproj when called from command line
body: <p>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:</p>
  
  <blockquote>
    <p>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\</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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?</p>