Esempio n. 1
0
    protected override void OnBuildInitialized()
    {
        base.OnBuildInitialized();
        var result =
            VSWhereTasks.VSWhere(s => s
                                 .SetVersion(RequiredMSBuildVersion)
                                 .EnableLatest()
                                 .EnablePrerelease()
                                 .EnableUTF8()
                                 .SetLogOutput(Verbosity == Verbosity.Verbose)
                                 .SetProperty("InstallationPath")
                                 .SetFormat(VSWhereFormat.value)
                                 ).Output.EnsureOnlyStd().FirstOrDefault().Text;

        var vsInstance = result.FirstOrDefault().NotNull($"Unable to find VS version {RequiredMSBuildVersion}");

        MSBuildToolPath = Path.Combine(result, "MSBuild\\Current\\Bin\\MSBuild.exe");
        Logger.Normal($"Using MSBuild at \"{MSBuildToolPath}\"");
        MSBuildLogger = CustomMSBuildLogger;
        NuGetLogger   = CustomNuGetLogger;
        if (IsServerBuild)
        {
            AzurePipelines.Instance.UpdateBuildNumber($"AlphaVSS-{GitVersion.SemVer}")
            ;
        }
    }
Esempio n. 2
0
    string GetMsBuildPath()
    {
        if (IsServerBuild)
        {
            return(null);
        }
        var vsWhere = VSWhereTasks.VSWhere(settings => settings
                                           .EnableLatest()
                                           .AddRequires("Microsoft.Component.MSBuild")
                                           .DisableProcessLogOutput()
                                           .DisableProcessLogInvocation()
                                           );

        if (vsWhere.Output.Count > 3)
        {
            return(null);
        }
        if (!File.Exists(CustomMsBuildPath))
        {
            throw new Exception($"Missing file: {CustomMsBuildPath}. Change the path to the build platform or install Visual Studio.");
        }
        return(CustomMsBuildPath);
    }