protected static MsBuildTaskFixtureResult <T> ExecuteMsBuildTaskInAzurePipeline <T>(T task, string buildNumber = null, string configurationText = null) where T : GitVersionTaskBase
        {
            var fixture = CreateRemoteRepositoryFixture();

            task.SolutionDirectory = fixture.LocalRepositoryFixture.RepositoryPath;
            var msbuildFixture       = new MsBuildTaskFixture(fixture);
            var environmentVariables = new List <KeyValuePair <string, string> >(env.ToArray());

            if (buildNumber != null)
            {
                environmentVariables.Add(new KeyValuePair <string, string>("BUILD_BUILDNUMBER", buildNumber));
            }
            msbuildFixture.WithEnv(environmentVariables.ToArray());
            if (configurationText != null)
            {
                CreateConfiguration(task.SolutionDirectory, configurationText);
            }

            var result = msbuildFixture.Execute(task);

            if (result.Success == false)
            {
                Console.WriteLine(result.Log);
            }
            return(result);
        }
Beispiel #2
0
        protected static MsBuildTaskFixtureResult <T> ExecuteMsBuildTaskInBuildServer <T>(T task) where T : GitVersionTaskBase
        {
            var fixture = CreateRemoteRepositoryFixture();

            task.SolutionDirectory = fixture.LocalRepositoryFixture.RepositoryPath;

            var msbuildFixture = new MsBuildTaskFixture(fixture);

            msbuildFixture.WithEnv(env.ToArray());
            return(msbuildFixture.Execute(task));
        }
Beispiel #3
0
        protected static MsBuildTaskFixtureResult <T> ExecuteMsBuildTaskInBuildServer <T>(T task) where T : GitVersionTaskBase
        {
            var fixture = CreateRemoteRepositoryFixture();

            task.SolutionDirectory = fixture.LocalRepositoryFixture.RepositoryPath;

            var msbuildFixture = new MsBuildTaskFixture(fixture);

            msbuildFixture.WithEnv(env.ToArray());
            var result = msbuildFixture.Execute(task);

            if (result.Success == false)
            {
                Console.WriteLine(result.Log);
            }
            return(result);
        }
        protected static MsBuildTaskFixtureResult <T> ExecuteMsBuildTaskInGitHubActions <T>(T task, string envFilePath) where T : GitVersionTaskBase
        {
            var fixture = CreateRemoteRepositoryFixture();

            task.SolutionDirectory = fixture.LocalRepositoryFixture.RepositoryPath;
            var msbuildFixture = new MsBuildTaskFixture(fixture);

            msbuildFixture.WithEnv(
                new KeyValuePair <string, string>("GITHUB_ACTIONS", "true"),
                new KeyValuePair <string, string>("GITHUB_ENV", envFilePath)
                );
            var result = msbuildFixture.Execute(task);

            if (result.Success == false)
            {
                Console.WriteLine(result.Log);
            }
            return(result);
        }