I have an MSBuild script that I want to call from a PowerShell script as part of a deployment process. If I call the build script via a bat file all works well. If I do the exact same thing in PowerShell I get CS1668 error looking for wierd and wonderful paths that dont exist on my machine. I know I am getting into the MSBuild script as these errors are occuring from within the MSBuild script targets (logging output is showing this). The bat file and the PowerShell script reside in the same place, right next to the build script.
Errors:
error CS1668 : Warning as error : Invalid search path 'C:\Program Files\Microsoft Visual Studio 8\VC\AtlMfc\Lib' specified in 'LIB environment variable' -- 'The system cannot find the path specified. ' error CS1668 : Warning as error : Invalid search path 'C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib' specified in 'LIB environment variable'-- 'The system cannot find the path specified. '
I have checked and neiter of these paths do NOT exist on my machine. Why would running from PowerShell change what paths MSBuild look for?
Thanks in advance
RhysC
EDIT- adding in code: NB the name of the MSBuild script is AutomatedDebug.build POWERSHELL SCRIPT:
#Begining of script
$CurrentPath = Split-Path (Split-Path $myinvocation.mycommand.path )
#Assign the Build script paths. 1 is for building and testsing, 1 is for deployment (to keep things clean)
$MSBuildScriptBuildAndTestPath = $CurrentPath + "\Tools\AutomatedDebug.build"
$MSBuildScriptDeployPath = $CurrentPath + "\Tools\Deploy.build"
#Run the automated build with tests
Write-Host "*** Run the automated build with tests ***"
C:\Windows\Microsoft.NET\Framework\v3.5\MSbuild.exe $MSBuildScriptBuildAndTestPath "/t:AllTests" "/l:FileLogger,Microsoft.Build.Engine;logfile=AllTests.log"
if($LastExitCode -ne 0)
{
throw "AllTests failed"
}
Write-Host "*** FINISHED: Run the automated build with tests ***"
Bat File
@C:\Windows\Microsoft.NET\Framework\v3.5\MSbuild.exe AutomatedDebug.build /t:AllTests /l:FileLogger,Microsoft.Build.Engine;logfile="AllTests.log"
@pause
enter code here