Beispiel #1
0
        public bool BuildProject()
        {
            Log = "";
            bool buildResultOK = false;

            BuildResultDll    = BuildResultSymbols = "";
            BuildResultAssets = null;
            try
            {
                using (bLogger BuildLogger = new bLogger())
                {
                    // usage Microsoft.Build.BuildEngine.Engine is prevelegy of MONO runtime
                    Microsoft.Build.BuildEngine.Engine eng = Microsoft.Build.BuildEngine.Engine.GlobalEngine;
                    eng.RegisterLogger(BuildLogger);
                    Microsoft.Build.BuildEngine.Project prj = new Microsoft.Build.BuildEngine.Project(eng);

                    prj.Load(ProjectLocation);

                    logger.Debug("building project: {0}", ProjectLocation);
                    // todo: add configuration set option

                    if (!string.IsNullOrWhiteSpace(this.Configuration))
                    {
                        eng.GlobalProperties.SetProperty("Configuration", this.Configuration);
                    }
                    string outd = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "_tempArtifacts");
                    eng.GlobalProperties.SetProperty("OutputPath", outd);
                    eng.GlobalProperties.SetProperty("Platform", "AnyCPU");

                    string fileLib = System.IO.Path.Combine(outd,
                                                            prj.GetEvaluatedProperty("TargetFileName"));
                    string fileSymbols = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(fileLib), System.IO.Path.GetFileNameWithoutExtension(fileLib) + ".mdb");

                    buildResultOK = prj.Build();
                    eng.UnregisterAllLoggers();

                    Log = BuildLogger.Result();
                    if (buildResultOK)
                    {
                        BuildResultDll     = fileLib;
                        BuildResultSymbols = fileSymbols;
                        List <string> files = new List <string>();
                        foreach (string F in System.IO.Directory.GetFiles(System.IO.Path.GetDirectoryName(fileLib)))
                        {// TODO: not recursive! not now...
                            if (F != BuildResultDll && F != BuildResultSymbols)
                            {
                                files.Add(F);
                            }
                        }
                        BuildResultAssets = files.ToArray();
                    }
                }
            }
            catch (Exception e)
            {
                Log += string.Format("major exception while build: {0}", e.Message);
            }
            return(buildResultOK);
        }
        public bool BuildProject()
        {
            Log = "";
            bool buildResultOK = false;
            BuildResultDll = BuildResultSymbols = "";
            BuildResultAssets = null;
            try
            {
                using (bLogger BuildLogger = new bLogger())
                {
                    // usage Microsoft.Build.BuildEngine.Engine is prevelegy of MONO runtime
                    Microsoft.Build.BuildEngine.Engine eng = Microsoft.Build.BuildEngine.Engine.GlobalEngine;
                    eng.RegisterLogger(BuildLogger);
                    Microsoft.Build.BuildEngine.Project prj = new Microsoft.Build.BuildEngine.Project(eng);

                    prj.Load(ProjectLocation);

                    logger.Debug("building project: {0}", ProjectLocation);
                    // todo: add configuration set option

                    if (!string.IsNullOrWhiteSpace(this.Configuration))
                        eng.GlobalProperties.SetProperty("Configuration", this.Configuration);
                    string outd = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "_tempArtifacts");
                    eng.GlobalProperties.SetProperty("OutputPath", outd);
                    eng.GlobalProperties.SetProperty("Platform", "AnyCPU");

                    string fileLib = System.IO.Path.Combine(outd,
                       prj.GetEvaluatedProperty("TargetFileName"));
                    string fileSymbols = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(fileLib), System.IO.Path.GetFileNameWithoutExtension(fileLib) + ".mdb");

                    buildResultOK = prj.Build();
                    eng.UnregisterAllLoggers();

                    Log = BuildLogger.Result();
                    if (buildResultOK)
                    {
                        BuildResultDll = fileLib;
                        BuildResultSymbols = fileSymbols;
                        List<string> files = new List<string>();
                        foreach (string F in System.IO.Directory.GetFiles(System.IO.Path.GetDirectoryName(fileLib)))
                        {// TODO: not recursive! not now...
                            if (F != BuildResultDll && F != BuildResultSymbols)
                            {
                                files.Add(F);
                            }
                        }
                        BuildResultAssets = files.ToArray();
                    }

                }
            }
            catch (Exception e)
            {
                Log += string.Format("major exception while build: {0}", e.Message);
            }
            return buildResultOK;
        }
Beispiel #3
0
        public bool BuildProject()
        {
            Log = "";
            bool buildResultOK = false;

            BuildResultDll    = BuildResultSymbols = "";
            BuildResultAssets = null;
            try
            {
                using (bLogger BuildLogger = new bLogger())
                {
                    Project p = new Project(ProjectLocation);

                    string path = p.GetPropertyValue("TargetPath");
                    string pdb  = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), System.IO.Path.GetFileNameWithoutExtension(path) + ".pdb");

                    logger.Debug("building project: {0}", ProjectLocation);

                    buildResultOK = p.Build(BuildLogger);
                    Log           = BuildLogger.Result();

                    if (buildResultOK)
                    {
                        BuildResultDll     = path;
                        BuildResultSymbols = pdb;
                        List <string> files = new List <string>();
                        foreach (string F in System.IO.Directory.GetFiles(System.IO.Path.GetDirectoryName(path)))// TODO: not recursive! not now...
                        {
                            if (F != BuildResultDll && F != BuildResultSymbols)
                            {
                                files.Add(F);
                            }
                        }
                        BuildResultAssets = files.ToArray();
                    }
                    ProjectCollection.GlobalProjectCollection.UnloadProject(p);
                }
            }
            catch (Exception e)
            {
                Log += string.Format("major exception while build: {0}", e.Message);
            }
            return(buildResultOK);
        }
Beispiel #4
0
        public bool BuildProject()
        {
            Log = "";
            bool buildResultOK = false;
            BuildResultDll = BuildResultSymbols = "";
            BuildResultAssets = null;
            try
            {
                using (bLogger BuildLogger = new bLogger())
                {
                    Project p = new Project(ProjectLocation);

                    string path = p.GetPropertyValue("TargetPath");
                    string pdb = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), System.IO.Path.GetFileNameWithoutExtension(path) + ".pdb");

                    logger.Debug("building project: {0}", ProjectLocation);

                    buildResultOK = p.Build(BuildLogger);
                    Log = BuildLogger.Result();

                    if (buildResultOK)
                    {
                        BuildResultDll = path;
                        BuildResultSymbols = pdb;
                        List<string> files = new List<string>();
                        foreach (string F in System.IO.Directory.GetFiles(System.IO.Path.GetDirectoryName(path)))// TODO: not recursive! not now...
                        {
                            if (F != BuildResultDll && F != BuildResultSymbols)
                            {
                                files.Add(F);
                            }
                        }
                        BuildResultAssets = files.ToArray();
                    }
                    ProjectCollection.GlobalProjectCollection.UnloadProject(p);
                }
            }
            catch (Exception e)
            {
                Log += string.Format("major exception while build: {0}", e.Message);
            }
            return buildResultOK;
        }