Exemplo n.º 1
0
        public static string Start(DotnetBuildParams objBuildParams)
        {
            try
            {
                ProjectCollection pc = new ProjectCollection();

                pc.DefaultToolsVersion = "4.0";
                Dictionary<string, string> GlobalProperty = new Dictionary<string, string>();

                GlobalProperty.Add("Configuration", objBuildParams.Configuration);

                GlobalProperty.Add("Platform", objBuildParams.Platform);

                //Here, we set the property

                GlobalProperty.Add("OutputPath", objBuildParams.OutputPath);

                BuildRequestData BuidlRequest = new BuildRequestData(objBuildParams.projectFileName, GlobalProperty, null, objBuildParams.TargetsToBuild, null);

                BuildResult buildResult = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), BuidlRequest);

                return  ((BuildResultCode)buildResult.OverallResult).ToString();

            }
            catch (Exception ex)
            {
                return BuildResultCode.Failure.ToString() ;
            }
            finally
            {

            }
        }
Exemplo n.º 2
0
        public string GetBuild_Click()
        {
            string[] solutionfiles = Common.GetFiles(ProjectLoaction, "sln");
            foreach (var item in solutionfiles)
            {

                ProjectDetails _project = _repository.GetProjectDetails(1);
                DotnetBuildParams objDotnetBuildParams = new DotnetBuildParams();
                objDotnetBuildParams.Configuration = _project.Configuration;
                objDotnetBuildParams.Platform = _project.PlatForm;
                objDotnetBuildParams.TargetsToBuild = new string[] { "Build" };
                objDotnetBuildParams.OutputPath = ProjectLoaction+"/"+_project.ReleaseVersion.LastOrDefault().ReleaseVersion1 ;
                objDotnetBuildParams.projectFileName = item;// @"D:\Automa.tion\TFS2010FromCSharp\TFS2010\TFS2010.sln";//D:\Test\TFSTest\OfficialPayments.MyAccount.sln";
                var result = DotNetBuild.Start(objDotnetBuildParams);
            }
            return "Success";
        }