Example #1
0
        protected void RunSolutionTask()
        {
            // create a copy of OpenPetra.sln, and remove all projects but FCSProjFile
            StreamReader sr = new StreamReader(FProjectFilesDir + Path.DirectorySeparatorChar + "OpenPetra.sln");
            StreamWriter sw = new StreamWriter(FProjectFilesDir + Path.DirectorySeparatorChar + "OpenPetra.Mini.sln");

            string projFile     = Path.GetFileName(FCSProjFile).ToLower();
            bool   foundProject = false;

            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine();

                if (line.StartsWith("Project("))
                {
                    if (line.ToLower().Contains(projFile))
                    {
                        sw.WriteLine(line);
                        sw.WriteLine("EndProject");
                        foundProject = true;
                    }
                }
                else if (!line.StartsWith("EndProject"))
                {
                    sw.WriteLine(line);
                }
            }

            sr.Close();
            sw.Close();

            if (!foundProject)
            {
                throw new Exception(
                          "cannot compile " + projFile + " because it cannot be found in " + FProjectFilesDir + Path.DirectorySeparatorChar +
                          "OpenPetra.sln");
            }

            // compile solution OpenPetra.Mini.sln
            CompileSolution sln = new CompileSolution();

            this.CopyTo(sln);

            sln.SolutionFile = FProjectFilesDir + Path.DirectorySeparatorChar + "OpenPetra.Mini.sln";

            sln.Execute();
        }
Example #2
0
        protected void RunSolutionTask()
        {
            // create a copy of OpenPetra.sln, and remove all projects but FCSProjFile
            StreamReader sr = new StreamReader(FProjectFilesDir + Path.DirectorySeparatorChar + "OpenPetra.sln");
            StreamWriter sw = new StreamWriter(FProjectFilesDir + Path.DirectorySeparatorChar + "OpenPetra.Mini.sln");

            string projFile = Path.GetFileName(FCSProjFile).ToLower();
            bool foundProject = false;

            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine();

                if (line.StartsWith("Project("))
                {
                    if (line.ToLower().Contains(projFile))
                    {
                        sw.WriteLine(line);
                        sw.WriteLine("EndProject");
                        foundProject = true;
                    }
                }
                else if (!line.StartsWith("EndProject"))
                {
                    sw.WriteLine(line);
                }
            }

            sr.Close();
            sw.Close();

            if (!foundProject)
            {
                throw new Exception(
                    "cannot compile " + projFile + " because it cannot be found in " + FProjectFilesDir + Path.DirectorySeparatorChar +
                    "OpenPetra.sln");
            }

            // compile solution OpenPetra.Mini.sln
            CompileSolution sln = new CompileSolution();
            this.CopyTo(sln);

            sln.SolutionFile = FProjectFilesDir + Path.DirectorySeparatorChar + "OpenPetra.Mini.sln";

            sln.Execute();
        }