public void BuildMergeProjectFromSelectedItem()
        {
            if (_currentSelectedMergePro == null)
            {
                return;
            }
            //---


            MergeProject mergePro = CreateMergeProjectPlan(_currentSelectedMergePro);
            //BY_CONVENTION:
            //set target to build output, set to x_autogen_projects dir
            //-----------------------------------
            string rootSlnFolder = _solutionMx.SolutionDir;
            string rightPart;
            string beginAt = _solutionMx.BuildPathRelativeToSolution(Application.ExecutablePath, out rightPart);

            string targetProjectName = _currentSelectedMergePro.ProjectName;
            string targetProjectFile = targetProjectName + ".csproj";
            string saveProjectName   = beginAt + "x_autogen\\" + targetProjectName + "\\" + targetProjectFile;

            string[] asmReferences = mergePro._asmReferences.ToArray();

            //-----------
            mergePro.MergeAndSave(saveProjectName,
                                  targetProjectName,
                                  mergePro.TargetFrameworkVersion,
                                  mergePro.DefineConstants,//additional define constant
                                  asmReferences);

            if (NetStdVersion != null)
            {
                //generate as dotnet std project
                LinkProjectConverter.ConvertToLinkProjectNetStd(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen_" + NetStdVersion + "\\" + targetProjectName,
                    NetStdVersion,
                    false);//after link project is created, we remove the targetProjectFile
            }
            else
            {
                LinkProjectConverter.ConvertToLinkProject(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen2\\" + targetProjectName,
                    false);//after link project is created, we remove the targetProjectFile
            }
            //-----------
        }
Esempio n. 2
0
        public static void ConvertToLinkProject2(SolutionMx slnMx, string srcProject, string autoGenFolder, bool removeOriginalSrcProject)
        {
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(srcProject);
            var    compileNodes     = SelectCompileNodes(xmldoc.DocumentElement);
            string onlyFileName     = Path.GetFileName(srcProject);
            string saveFileName     = slnMx.SolutionDir + "\\" + autoGenFolder + "\\" + onlyFileName;
            string targetSaveFolder = slnMx.SolutionDir + "\\" + autoGenFolder;
            string rightPart;

            string beginAt = slnMx.BuildPathRelativeToSolution(targetSaveFolder, out rightPart);

            foreach (XmlElement elem in compileNodes)
            {
                XmlAttribute includeAttr  = elem.GetAttributeNode("Include");
                string       includeValue = includeAttr.Value;
                string       combinedPath = SolutionMx.CombineRelativePath(includeValue);


                string b2 = slnMx.BuildPathRelativeToOther(targetSaveFolder, combinedPath, out rightPart);
                //this version:
                //auto gen project is lower than original 1 level
                //so change the original src location
                //and create linked child node
                includeAttr.Value = "..\\" + beginAt + rightPart;


                XmlElement linkNode = xmldoc.CreateElement("Link", elem.NamespaceURI);
                linkNode.InnerText = rightPart;
                elem.AppendChild(linkNode);
            }

            string targetSaveDir = System.IO.Path.GetDirectoryName(saveFileName);

            if (!Directory.Exists(targetSaveDir))
            {
                Directory.CreateDirectory(targetSaveDir);
            }

            xmldoc.Save(saveFileName);
            if (removeOriginalSrcProject)
            {
                File.Delete(srcProject);
            }
        }
Esempio n. 3
0
        public void BuildMergeProjectFromSelectedItem()
        {
            if (_currentSelectedMergePro == null)
            {
                return;
            }
            //---


            MergeProject mergePro = CreateMergeProjectPlan(_currentSelectedMergePro);
            //BY_CONVENTION:
            //set target to build output, set to x_autogen_projects dir
            //-----------------------------------
            string rootSlnFolder = _solutionMx.SolutionDir;
            string rightPart;
            string beginAt = _solutionMx.BuildPathRelativeToSolution(Application.ExecutablePath, out rightPart);

            string targetProjectName = _currentSelectedMergePro.ProjectName;//  "PixelFarm.MiniAgg.One";
            string targetProjectFile = targetProjectName + ".csproj";
            string saveProjectName   = beginAt + "x_autogen\\" + targetProjectName + "\\" + targetProjectFile;

            string[] asmReferences = mergePro._asmReferences.ToArray();

            //mergePro.MergeAndSave(saveProjectName,
            //   targetProjectName,
            //   "v2.0",
            //   " PIXEL_FARM,PIXEL_FARM_NET20",//additional define constant
            //   asmReferences);

            //-----------
            mergePro.MergeAndSave(saveProjectName,
                                  targetProjectName,
                                  mergePro.TargetFrameworkVersion,
                                  mergePro.DefineConstants,//additional define constant
                                  asmReferences);

            //-----------
            LinkProjectConverter.ConvertToLinkProject2(
                _solutionMx,
                saveProjectName,
                "x_autogen2\\" + targetProjectName,
                false);//after link project is created, we remove the targetProjectFile
        }
        public void BuildMergeProjectFromSelectedItem()
        {
            if (_currentSelectedMergePro == null)
            {
                return;
            }
            //---


            MergeProject mergePro = CreateMergeProjectPlan(_currentSelectedMergePro);
            //BY_CONVENTION:
            //set target to build output, set to x_autogen_projects dir
            //-----------------------------------
            string rootSlnFolder = _solutionMx.SolutionDir;
            string rightPart;
            string beginAt = _solutionMx.BuildPathRelativeToSolution(Application.ExecutablePath, out rightPart);

            string targetProjectName = _currentSelectedMergePro.ProjectName;
            string targetProjectFile = targetProjectName + ".csproj";
            string saveProjectName   = beginAt + "x_autogen\\" + targetProjectName + "\\" + targetProjectFile;

            string[] asmReferences = mergePro._asmReferences.ToArray();

            //-----------
            mergePro.MergeAndSave(saveProjectName,
                                  targetProjectName,
                                  mergePro.TargetFrameworkVersion,
                                  mergePro.DefineConstants,//additional define constant
                                  asmReferences);

            switch (ProjectKind)
            {
            case "classic":
            {
                LinkProjectConverter.ConvertToLinkProject(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen2\\" + targetProjectName,
                    false);       //after link project is created, we remove the targetProjectFile
            }
            break;

            case "xamarin_ios":
            {
                //create xamarin ios lib
                LinkProjectConverter.ConvertToLinkProjectXamarin_ios(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen_" + ProjectKind + "\\" + targetProjectName,
                    ProjectKind,
                    false);
            }
            break;

            case "xamarin_droid":
            {
                LinkProjectConverter.ConvertToLinkProjectXamarin_droid(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen_" + ProjectKind + "\\" + targetProjectName,
                    ProjectKind,
                    false);
            }
            break;

            case "xamarin_ios_and_droid":
            {
                //ios
                LinkProjectConverter.ConvertToLinkProjectXamarin_ios(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen_" + ProjectKind + "\\" + targetProjectName,
                    ProjectKind,
                    false);

                //android
                LinkProjectConverter.ConvertToLinkProjectXamarin_droid(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen_" + ProjectKind + "\\" + targetProjectName,
                    ProjectKind,
                    false);
            }
            break;

            default:
            {
                //
                //generate as dotnet std project
                LinkProjectConverter.ConvertToLinkProjectNetStd(
                    _solutionMx,
                    saveProjectName,
                    "x_autogen_" + ProjectKind + "\\" + targetProjectName,
                    ProjectKind,
                    false);        //after link project is created, we remove the targetProjectFile
            }
            break;
            }
        }