命令行和VisualStudio之间的编译输出不同

时间:2017-09-03 12:02:25

标签: visual-studio powershell msbuild

我已经生成了基于实用程序的power shell,它可以编译我们的VS2015解决方案。 问题是有一些解决方案失败,因为ms build无法找到其引用的一部分。 当我使用Visual Studio GUI编译它们时,成功编译它们没有问题。编译配置相同(混合平台|调试,不干净,Nuget为真)。

见打印屏幕:

CommandLine

VS2015

我正在附加编译功能:

function buildVS
{
    param
    (
        [parameter(Mandatory=$true)]
        [String] $path,

        [parameter(Mandatory=$true)]
        [String] $Configuration,

        [parameter(Mandatory=$true)]
        [String] $Platform,

        [parameter(Mandatory=$false)]
        [bool]   $nuget = $true,

        [parameter(Mandatory=$false)]
        [bool]   $clean = $true
    )
    process
    {
        $msBuildExe = 'C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe'

        if ($nuget) {
            $nl
            Write-Host "Restoring NuGet packages" -foregroundcolor green
            nuget restore "$($path)"
        }

        if ($clean) {
            $nl
            Write-Host "Cleaning $($path)" -foregroundcolor green
            & "$($msBuildExe)" "$($path)" "" /t:Clean /m
        }

        $nl
        Write-Host "Building $($path)" -foregroundcolor green
        try
        {
            & "$($msBuildExe)" "$($path)" ("/p:Configuration=" + $Configuration) ("/p:Platform=" + $Platform) ("/p:PreBuildEvent=") ("/p:PostBuildEvent=") ("/m") 2>&1
        }
        catch    
        {
            Write-Error "Build compilation Build FAILEDed" + $_.Exception.Message
        }
    }
}

0 个答案:

没有答案