示例#1
0
        public static void Add()
        {
            var project = Project.Load("testproj.csproj");

            var references = new ItemGroup();

            var reference = new Reference("Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL");

            reference.HintPath = "..\\packages\\Newtonsoft.Json.11.0.1\\lib\\net45\\Newtonsoft.Json.dll";

            reference.Private = "True";

            references.Add(reference);

            var files = new ItemGroup();

            var file = new Compile("path\\to\\class.cs");

            file.DependentUpon = "path\\to\\page.cshtml";

            files.Add(file);

            project.Add(references);
            project.Add(files);

            project.Save();
        }
示例#2
0
        public static void AddAfterFirstItemGroup()
        {
            var project = Project.Load("testproj.csproj");

            var itemGroup = new ItemGroup();

            var newFile = new Compile("testfile.cs");

            itemGroup.Add(newFile);

            var firstItemGroup = project.ItemGroups.First();

            firstItemGroup.AddAfterSelf(itemGroup);

            var referenceItemGroup = new ItemGroup();

            var guid = Guid.NewGuid();

            var reference = new ProjectReference("../classlibrary/classlibrary.csproj")
            {
                Project = $"{{{guid}}}",
                Name    = "Some.Namespace",
            };

            // Add a Condition attribute to an item Metadata
            reference.Metadata["Project"].Condition = " '${CustomProperty}' == 'CustomValue' ";

            referenceItemGroup.Add(reference);

            itemGroup.AddAfterSelf(referenceItemGroup);

            project.Save();
        }
示例#3
0
 public void SetWarehouseGroup(List <Item> warehouseList)
 {
     WarehouseGroup.Clear();
     for (int i = 0; i < warehouseList.Count; i++)
     {
         WarehouseGroup.Add(warehouseList[i]);
     }
 }
示例#4
0
 public void SetBagGroup(List <Item> bagList)
 {
     BagGroup.Clear();
     for (int i = 0; i < bagList.Count; i++)
     {
         BagGroup.Add(bagList[i]);
     }
 }
示例#5
0
 protected void AddSelection(SelectButton selection)
 {
     if (null == selection)
     {
         return;
     }
     if (ItemGroup.Contains(selection))
     {
         return;
     }
     ItemGroup.Add(selection);
     selection.SelectedChanged += OnSelectedChanged;
 }
示例#6
0
        public static void Create()
        {
            var testproject = ProjectExtensions.CreateDefaultConsole("netcoreapp3.1");

            var itemGroup1 = new ItemGroup();

            var newFile1 = new Compile("testfile.cs");

            itemGroup1.Add(newFile1);

            testproject.Add(itemGroup1);

            testproject.SaveAs("testconsole.csproj");
        }
示例#7
0
        protected internal void AddSelection(SelectButton selection)
        {
            if (null == selection)
            {
                return;
            }
            if (ItemGroup.Contains(selection))
            {
                return;
            }

            selection.RemoveFromGroup();
            ItemGroup.Add(selection);
            selection.SelectedChanged += GroupSelectionHandler;
        }
示例#8
0
        public static void AddBeforeLastImport()
        {
            var project = Project.Load("testproj.csproj");

            var lastImport = project.Imports.Last();

            var itemGroup = new ItemGroup();

            var newFile = new Compile("testfile.cs");

            itemGroup.Add(newFile);

            lastImport.AddBeforeSelf(itemGroup);

            project.Save();
        }
示例#9
0
        void SaveSettings()
        {
            for (int i = 0; i < chkListBoxBootstrappers.Items.Count; i++)
            {
                Util.BootstrapperPackage package = chkListBoxBootstrappers.Items[i] as Util.BootstrapperPackage;
                if (package == null)
                {
                    continue;
                }

                bool isChecked = chkListBoxBootstrappers.GetItemChecked(i);

                ItemGroup itemGroup = config.ItemGroupBootstrapperPackages;

                BootstrapperPackageItem item = null;
                if (itemGroup.ContainsKey(package.ProductCode))
                {
                    item = itemGroup[package.ProductCode] as BootstrapperPackageItem;
                }
                else
                {
                    item = new BootstrapperPackageItem(package.ProductCode);
                    itemGroup.Add(item);
                }

                item.Install = isChecked;
            }

            CsProject.PropertyCollection properties = config.PropertyItems;
            properties.BootstrapperEnabled = chkBootstrapperEnabled.Checked;

            if (radioComponentsLocationRelative.Checked)
            {
                properties.BootstrapperComponentsLocation = CsProject.BootstrappersLocations.Relative;
            }
            else if (radioComponentsLocationAbsolute.Checked)
            {
                properties.BootstrapperComponentsLocation = CsProject.BootstrappersLocations.Absolute;
            }
            else
            {
                properties.BootstrapperComponentsLocation = CsProject.BootstrappersLocations.Default;
            }
            properties.BootstrapperComponentsUrl = cmbBootstrapperComponentsUrl.Text;
        }
示例#10
0
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
#if DEMO
            if (listBoxIncludedItems.Items.Count >= 2)
            {
                PosDialogWindow.ShowDialog(Strings.ItemEditorErrorDemo,
                                           Strings.ItemEditorDemoRestriction);
                return;
            }
#endif
            FormattedListBoxItem formattedListBoxItem = listBoxAvailableItems.SelectedItem as FormattedListBoxItem;
            if (formattedListBoxItem != null)
            {
                Item item = formattedListBoxItem.ReferenceObject as Item;
                if (item != null)
                {
                    _itemGroupsAdded.Add(ItemGroup.Add(0, item.Id, 1));
                }
            }
            InitializeListBoxes();
            DoValueChangedEvent();
        }
示例#11
0
        public static Project CreateDefaultConsole(string targetFramework)
        {
            var project = Project.CreateVS2017Project();

            var propertyGroup = new PropertyGroup();

            propertyGroup.SetProperty("OutputType", "Exe");
            propertyGroup.SetProperty("TargetFramework", targetFramework);
            project.Add(propertyGroup);

            var itemGroup   = new ItemGroup();
            var appSettings = new None()
            {
                Update = "appsettings.json"
            };

            appSettings.SetMetadata("CopyToOutputDirectory", "PreserveNewest");
            itemGroup.Add(appSettings);
            project.Add(itemGroup);

            return(project);
        }
示例#12
0
        private static ItemGroup ReadItemGroup(XmlReader reader)
        {
            reader.MoveToContent();
            var condition = reader.TryReadCondition();
            var items     = new ItemGroup(condition);

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    var include    = reader.GetAttribute("Include");
                    var condition2 = reader.TryReadCondition();
                    var metadata   = ReadMetadata(reader.ReadSubtree());
                    var item       = new ProjectItem(reader.Name,
                                                     include, null, null, condition2,
                                                     metadata);
                    items.Add(item);
                    reader.Skip();
                }
            }

            return(items);
        }
        public Clinic GetClinicalNewMobile(DataConnection pclsCache, string UserId, DateTime AdmissionDate, DateTime ClinicDate, int Num)
        {
            //最终输出
            Clinic Clinic = new Clinic();

            Clinic.UserId  = UserId;
            Clinic.History = new List <ClinicBasicInfoandTime>();
            try
            {
                List <DT_Clinical_All> DT_Clinical_All = new List <DT_Clinical_All>();   //住院,门诊、检查化验。。。混合表
                //DT_Clinical_All.Columns.Add(new DataColumn("精确时间", typeof(DateTime)));
                //DT_Clinical_All.Columns.Add(new DataColumn("时间", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("类型", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("VisitId", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("事件", typeof(string)));
                //DT_Clinical_All.Columns.Add(new DataColumn("关键属性", typeof(string)));  //检查化验的详细查看  例:examnation|

                //颜色由文字决定


                #region 读取两张就诊表,并通过VisitId取出其他数据(检查、化验等)  全部拿出 按时间  VID 类型  排序后,合并

                List <ClinicalTrans> DT_Clinical_ClinicInfo = new List <ClinicalTrans>();
                DT_Clinical_ClinicInfo = clinicInfoMethod.PsClinicalInfoGetClinicalInfoNum(pclsCache, UserId, AdmissionDate, ClinicDate, Num);
                if (DT_Clinical_ClinicInfo != null)
                {
                    #region
                    if (DT_Clinical_ClinicInfo.Count > 1)    //肯定大于0,最后一条是标记,必须传回;大于1表明时间轴还可以加载
                    {
                        #region  拿出临床信息

                        for (int i = 0; i < DT_Clinical_ClinicInfo.Count - 1; i++)                                                 //最后一条是标记,需要单独拿出
                        {
                            string          DateShow = Convert.ToDateTime(DT_Clinical_ClinicInfo[i].精确时间).ToString("yyyy年MM月dd日"); //取日期
                            DT_Clinical_All item     = new DT_Clinical_All();
                            item.精确时间    = DT_Clinical_ClinicInfo[i].精确时间;
                            item.时间      = DateShow;
                            item.类型      = DT_Clinical_ClinicInfo[i].类型;
                            item.VisitId = DT_Clinical_ClinicInfo[i].VisitId;
                            item.事件      = DT_Clinical_ClinicInfo[i].事件;
                            item.关键属性    = "";
                            DT_Clinical_All.Add(item);
                            if (DT_Clinical_ClinicInfo[i].类型.ToString() == "入院")
                            {
                                //转科处理  转科内容:什么时候从哪里转出,什么时候转到哪里
                                List <ClinicalTrans> DT_Clinical_Trans = new List <ClinicalTrans>();
                                DT_Clinical_Trans = clinicInfoMethod.PsClinicalInfoGetTransClinicalInfo(pclsCache, UserId, DT_Clinical_ClinicInfo[i].VisitId.ToString());
                                if (DT_Clinical_Trans.Count > 0)  //有转科
                                {
                                    for (int n = 0; n < DT_Clinical_Trans.Count; n++)
                                    {
                                        string DateShow1 = Convert.ToDateTime(DT_Clinical_Trans[n].精确时间).ToString("yyyy年MM月dd日");  //取日期
                                        item.精确时间    = DT_Clinical_Trans[n].精确时间;
                                        item.时间      = DateShow1;
                                        item.类型      = "转科";
                                        item.VisitId = DT_Clinical_Trans[n].VisitId;
                                        item.事件      = DT_Clinical_Trans[n].事件;
                                        item.关键属性    = "";
                                        DT_Clinical_All.Add(item);
                                    }
                                }
                            }


                            if ((DT_Clinical_ClinicInfo[i].类型.ToString() == "入院") || (DT_Clinical_ClinicInfo[i].类型.ToString() == "门诊") || (DT_Clinical_ClinicInfo[i].类型.ToString() == "急诊"))
                            {
                                //诊断检查等
                                List <ClinicalTrans> DT_Clinical_Others = new List <ClinicalTrans>();
                                DT_Clinical_Others = clinicInfoMethod.PsClinicalInfoGetOtherTable(pclsCache, UserId, DT_Clinical_ClinicInfo[i].VisitId.ToString());


                                if (DT_Clinical_Others.Count > 0)
                                {
                                    for (int n = 0; n < DT_Clinical_Others.Count; n++)
                                    {
                                        string DateShow2 = Convert.ToDateTime(DT_Clinical_Others[n].精确时间).ToString("yyyy年MM月dd日");  //取日期
                                        item.精确时间    = DT_Clinical_Others[n].精确时间;
                                        item.时间      = DateShow2;
                                        item.类型      = DT_Clinical_Others[n].类型;
                                        item.VisitId = DT_Clinical_Others[n].VisitId;
                                        item.事件      = DT_Clinical_Others[n].事件;
                                        item.关键属性    = DT_Clinical_Others[n].关键属性;
                                        DT_Clinical_All.Add(item);
                                    }

                                    //DataRow[] rows = DT_Clinical_Others.Select();
                                    //foreach (DataRow row in rows)  // 将查询的结果添加到dt中;
                                    //{
                                    //    DT_Clinical_All.Rows.Add(row.ItemArray);
                                    //}
                                    //for(int j=0; j<DT_Clinical_Others.Rows.Count;j++)
                                    //{
                                    //     DT_Clinical_All.Rows.Add(DT_Clinical_Others.Rows[j]);
                                    //}
                                }
                            }
                        } //for循环的结尾
                        #endregion


                        //排序   按“精准时间”, “VID”    排序后, “时间”、“VID”相同的合并  【精准时间到s,时间到天】
                        DT_Clinical_All.Sort((x, y) => - (x.时间.CompareTo(y.时间) * 3 + x.VisitId.CompareTo(y.VisitId) * 2 - x.精确时间.CompareTo(y.精确时间)));
                        //dv.Sort = "时间 desc,  VisitId desc, 精确时间 Asc"; //目前采用方案二,
                        //时间轴需要倒序,升序Asc    时间轴最外层 日期倒序 某一天内按照时分升序  注意:遇到同一天 又住院又门诊的,即不同VID  方案:一、不拆开,按时间排即可,问题是会混乱; 二,拆开,时间、VID、精确时间   这样的话,按照目前是在一个方框里 颜色字体大小区分开
                        List <DT_Clinical_All> dtNew = DT_Clinical_All;

                        #region 如果两者“时间”、“VID”相同则合并   时间轴方框标签-完成后遍历每一个方框内的事件确定标签

                        List <ClinicBasicInfoandTime> history     = new List <ClinicBasicInfoandTime>(); //总  时间、事件的集合
                        ClinicBasicInfoandTime        temphistory = new ClinicBasicInfoandTime();
                        if (dtNew != null)
                        {
                            #region
                            if (dtNew.Count > 0)
                            {
                                string TimeMark    = dtNew[0].时间.ToString();
                                string VisitIdMark = dtNew[0].VisitId.ToString();
                                temphistory.Time    = TimeMark;
                                temphistory.VisitId = VisitIdMark;

                                List <SomeDayEvent> ItemGroup    = new List <SomeDayEvent>();
                                SomeDayEvent        SomeDayEvent = new SomeDayEvent();
                                SomeDayEvent.Type    = dtNew[0].类型.ToString();                              //已有类型集合:入院、出院、转科、门诊、急诊、当前住院中;诊断、检查、化验、用药   【住院中未写入】
                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[0].精确时间).ToString("HH:mm"); //取时分 HH:mm(24) hh:mm(12)
                                SomeDayEvent.Event   = dtNew[0].事件.ToString();
                                SomeDayEvent.KeyCode = dtNew[0].关键属性.ToString();
                                ItemGroup.Add(SomeDayEvent);

                                if (dtNew.Count > 1)
                                {
                                    for (int i = 1; i < dtNew.Count; i++)
                                    {
                                        string TimeMark1    = dtNew[i].时间.ToString();
                                        string VisitIdMark1 = dtNew[i].VisitId.ToString();

                                        if (i == dtNew.Count - 1)
                                        {
                                            if ((TimeMark1 == TimeMark) && (VisitIdMark1 == VisitIdMark))
                                            {
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);

                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);
                                            }
                                            else
                                            {
                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);

                                                temphistory         = new ClinicBasicInfoandTime();
                                                temphistory.Time    = TimeMark1;
                                                temphistory.VisitId = VisitIdMark1;

                                                ItemGroup            = new List <SomeDayEvent>();
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);

                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);
                                            }
                                        }
                                        else
                                        {
                                            if ((TimeMark1 == TimeMark) && (VisitIdMark1 == VisitIdMark))
                                            {
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);
                                            }
                                            else
                                            {
                                                temphistory.ItemGroup = ItemGroup;
                                                history.Add(temphistory);

                                                temphistory         = new ClinicBasicInfoandTime();
                                                temphistory.Time    = TimeMark1;
                                                temphistory.VisitId = VisitIdMark1;

                                                ItemGroup            = new List <SomeDayEvent>();
                                                SomeDayEvent         = new SomeDayEvent();
                                                SomeDayEvent.Type    = dtNew[i].类型.ToString();
                                                SomeDayEvent.Time    = Convert.ToDateTime(dtNew[i].精确时间).ToString("HH:mm");
                                                SomeDayEvent.Event   = dtNew[i].事件.ToString();
                                                SomeDayEvent.KeyCode = dtNew[i].关键属性.ToString();
                                                ItemGroup.Add(SomeDayEvent);

                                                TimeMark    = TimeMark1;
                                                VisitIdMark = VisitIdMark1;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    temphistory.ItemGroup = ItemGroup;
                                    history.Add(temphistory);
                                }
                            }
                            #endregion
                        }

                        #endregion


                        #region 时间轴块标签、颜色
                        //类型 入院、出院、转科、门诊、急诊、当前住院中;诊断、检查、化验、用药   【住院中未写入】
                        //标签 入院、出院、转科、门诊、住院中、急诊
                        if (history != null)
                        {
                            #region
                            for (int n = 0; n < history.Count; n++)
                            {
                                for (int m = 0; m < history[n].ItemGroup.Count; m++)
                                {
                                    if ((history[n].ItemGroup[m].Type == "入院") || (history[n].ItemGroup[m].Type == "出院") || (history[n].ItemGroup[m].Type == "转科") || (history[n].ItemGroup[m].Type == "门诊") || (history[n].ItemGroup[m].Type == "急诊") || (history[n].ItemGroup[m].Type == "当前住院中"))
                                    {
                                        history[n].Tag += history[n].ItemGroup[m].Type + "、";
                                    }
                                }

                                if ((history[n].Tag == "") || (history[n].Tag == null))
                                {
                                    //防止门诊、急诊逸出
                                    if (history[n].VisitId.Substring(0, 1) == "I")  //住院
                                    {
                                        history[n].Tag   = "住院中";
                                        history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor("住院中");
                                    }
                                    else if (history[n].VisitId.Substring(0, 1) == "O") //门诊
                                    {
                                        history[n].Tag   = "";                          //门诊
                                        history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor("门诊");
                                    }
                                    else if (history[n].VisitId.Substring(0, 1) == "E") //急诊
                                    {
                                        history[n].Tag   = "";                          //急诊
                                        history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor("急诊");
                                    }
                                    //history[n].Tag = "住院中";
                                    //history[n].Color = PsClinicalInfo.GetColor("住院中");
                                }
                                else
                                {
                                    int z = history[n].Tag.IndexOf("、");
                                    //history[n].Color = PsClinicalInfo.GetColor(history[n].Tag.Substring(0, z));   //若有多个标签,颜色取第一个
                                    history[n].Tag = history[n].Tag.Substring(0, history[n].Tag.Length - 1);                                                   //去掉最后的、
                                    //int end= history[n].Tag.LastIndexOf("、")+1;
                                    history[n].Color = clinicInfoMethod.PsClinicalInfoGetColor(history[n].Tag.Substring(history[n].Tag.LastIndexOf("、") + 1)); //若有多个标签,颜色取最后一个
                                }
                            }
                            #endregion
                        }


                        #endregion

                        Clinic.History = history;   //时间轴
                    }  //if (DT_Clinical_ClinicInfo.Rows.Count > 1)的结尾


                    //取出指针标记
                    int mark = DT_Clinical_ClinicInfo.Count - 1;
                    Clinic.AdmissionDateMark = DT_Clinical_ClinicInfo[mark].精确时间.ToString();
                    Clinic.ClinicDateMark    = DT_Clinical_ClinicInfo[mark].类型.ToString();

                    //确定是否能继续加载
                    if ((DT_Clinical_ClinicInfo.Count - 1) < Num)
                    {
                        Clinic.mark_contitue = "0";
                    }
                    else
                    {
                        string mark_in  = clinicInfoMethod.PsClinicalInfoGetNextInDate(pclsCache, UserId, Clinic.AdmissionDateMark);
                        string mark_out = clinicInfoMethod.PsClinicalInfoGetNextOutDate(pclsCache, UserId, Clinic.ClinicDateMark);
                        if (((mark_in == "") && (mark_out == "")) || ((mark_in == null) && (mark_out == null)))
                        {
                            Clinic.mark_contitue = "0";
                        }
                        else
                        {
                            Clinic.mark_contitue = "1";
                        }
                    }
                    #endregion
                }
                #endregion

                return(Clinic);
                //string result_final = JSONHelper.ObjectToJson(Clinic);
                //Context.Response.BinaryWrite(new byte[] { 0xEF, 0xBB, 0xBF });
                //Context.Response.Write(result_final);

                //Context.Response.End();
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "GetReminder", "WebService调用异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                // return null;
                throw (ex);
            }
        }
        public void RefreshPublishFiles()
        {
            string basePath = Path.GetDirectoryName(this.FileName);
            string distPath = pubSettings.DistributionPath;

            if (!Directory.Exists(distPath))
            {
                return;
            }

            List <string> fileNames = new List <string>();

            getFileNames(fileNames, distPath);

            ItemGroup itemGroupContents     = items.Groups["Content"];
            ItemGroup itemGroupPublishFiles = items.Groups["PublishFile"];

            foreach (string file in fileNames)
            {
                string fullName = Path.GetFullPath(file);
                string include  = Sense.Utils.IO.Path.GetRelativePath(basePath, fullName);
                string link     = Sense.Utils.IO.Path.GetRelativePath(distPath, fullName);
                if (!itemGroupContents.ContainsKey(fullName))
                {
                    ContentItem item = new ContentItem(basePath, include, link);
                    item.CopyToOutputDirectory = "PreserveNewest";
                    itemGroupContents.Add(item);
                }
                if (!itemGroupPublishFiles.ContainsKey(link))
                {
                    PublishFileItem item = new PublishFileItem(link);
                    item.Visible      = false;
                    item.Group        = "";
                    item.TargetPath   = "";
                    item.PublishState = PublishState.Include;
                    item.IncludeHash  = true;
                    item.FileType     = "File";
                    itemGroupPublishFiles.Add(item);
                }
            }
            List <string> removes = new List <string>();

            foreach (string fullName in itemGroupContents.GetKeys())
            {
                if (!fileNames.Contains(fullName))
                {
                    removes.Add(fullName);
                }
            }
            foreach (string fullName in removes)
            {
                if (itemGroupContents.ContainsKey(fullName))
                {
                    itemGroupContents.Remove(fullName);
                }
            }
            removes.Clear();
            foreach (string item in itemGroupPublishFiles.GetKeys())
            {
                bool found = false;
                foreach (ContentItem contentItem in itemGroupContents)
                {
                    string include = null;
                    if (contentItem.NeedLinkNode(basePath))
                    {
                        include = contentItem.Link;
                    }
                    else
                    {
                        include = contentItem.GetInclude(basePath);
                    }

                    if (item == include)
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    continue;
                }
                removes.Add(item);
            }
            foreach (string item in removes)
            {
                if (itemGroupPublishFiles.ContainsKey(item))
                {
                    itemGroupPublishFiles.Remove(item);
                }
            }
        }
示例#15
0
        public static Project CreateDefaultConsole(Guid projectGuid, string rootNameSpace, string assemblyName, string targetFrameworkVersion)
        {
            var project = Project.CreatePreVS2017Project();

            var import = new Import(@"$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props")
            {
                Condition = @"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"
            };

            project.Add(import);

            var propertyGroup = new PropertyGroup();

            propertyGroup.SetProperty("Configuration", "Debug", " '$(Configuration)' == '' ");
            propertyGroup.SetProperty("Platform", "AnyCPU", " '$(Platform)' == '' ");
            propertyGroup.SetProperty("ProjectGuid", $"{{{projectGuid.ToString().ToUpper()}}}");
            propertyGroup.SetProperty("OutputType", "Exe");
            propertyGroup.SetProperty("RootNamespace", rootNameSpace);
            propertyGroup.SetProperty("AssemblyName", assemblyName);
            propertyGroup.SetProperty("TargetFrameworkVersion", targetFrameworkVersion);
            propertyGroup.SetProperty("FileAlignment", "512");
            propertyGroup.SetProperty("AutoGenerateBindingRedirects", "true");
            propertyGroup.SetProperty("Deterministic", "true");
            project.Add(propertyGroup);

            var debugPropertyGroup = new PropertyGroup {
                Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
            };

            debugPropertyGroup.SetProperty("PlatformTarget", "AnyCPU");
            debugPropertyGroup.SetProperty("DebugSymbols", "true");
            debugPropertyGroup.SetProperty("DebugType", "true");
            debugPropertyGroup.SetProperty("DebugSymbols", "full");
            debugPropertyGroup.SetProperty("Optimize", "false");
            debugPropertyGroup.SetProperty("OutputPath", @"bin\Debug\");
            debugPropertyGroup.SetProperty("DefineConstants", "DEBUG;TRACE");
            debugPropertyGroup.SetProperty("ErrorReport", "prompt");
            debugPropertyGroup.SetProperty("WarningLevel", "4");
            project.Add(debugPropertyGroup);

            var releasePropertyGroup = new PropertyGroup {
                Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
            };

            releasePropertyGroup.SetProperty("PlatformTarget", "AnyCPU");
            releasePropertyGroup.SetProperty("DebugType", "pdbonly");
            releasePropertyGroup.SetProperty("Optimize", "true");
            releasePropertyGroup.SetProperty("OutputPath", @"bin\Release\");
            releasePropertyGroup.SetProperty("DefineConstants", "TRACE");
            releasePropertyGroup.SetProperty("ErrorReport", "prompt");
            releasePropertyGroup.SetProperty("WarningLevel", "4");
            project.Add(releasePropertyGroup);

            var referenceItemGroup = new ItemGroup();

            referenceItemGroup.Add(new Reference("System"));
            referenceItemGroup.Add(new Reference("System.Core"));
            referenceItemGroup.Add(new Reference("System.Xml.Linq"));
            referenceItemGroup.Add(new Reference("System.Data.DataSetExtensions"));
            referenceItemGroup.Add(new Reference("Microsoft.CSharp"));
            referenceItemGroup.Add(new Reference("System.Data"));
            referenceItemGroup.Add(new Reference("System.Net.Http"));
            referenceItemGroup.Add(new Reference("System.Xml"));
            project.Add(referenceItemGroup);

            var targetsImport = new Import(@"$(MSBuildToolsPath)\Microsoft.CSharp.targets");

            project.Add(targetsImport);

            return(project);
        }