csharp 来自csvj的getFrameworkVersion在tfvc上

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 来自csvj的getFrameworkVersion在tfvc上相关的知识,希望对你有一定的参考价值。

public string GetFrameworkVersion(object parsedProject)
        {

            //TimeTrackerService/TimeTrackerService.csproj 
            if(parsedProject.GetType() == typeof(CsProjCORE))
            {
                foreach(Models.CsProjCORE.ProjectPropertyGroup currentProjectPropertyGroup in ((CsProjCORE)parsedProject).PropertyGroup)
                {
                    if(currentProjectPropertyGroup.TargetFramework != null) return currentProjectPropertyGroup.TargetFramework;
                }
            }


            //$/Root/Cvh/Cvh.Plin/Dev/Cvh.Plin.Web/Cvh.Plin.Web.csproj
            else if(parsedProject.GetType() == typeof(CsProjClassic))
            {
                foreach(object currentProperty in ((CsProjClassic)parsedProject).Items)
                {
                    if(currentProperty.GetType() == typeof(Models.CsProjClassic.ProjectPropertyGroup))
                    {
                        Models.CsProjClassic.ProjectPropertyGroup properties = (Models.CsProjClassic.ProjectPropertyGroup)currentProperty;
                        for(int i = 0;i < properties.Items.Count();i++)
                        {
                            if(properties.ItemsElementName[i] == Models.CsProjClassic.ItemsChoiceType.TargetFrameworkVersion)
                            {
                                return properties.Items[i].ToString();
                            }
                        }

                    }
                }
            }

            //$/Root/Cvh/Transferi/MupWebService/Dev/Inc.MupWebService.WcfService/Inc.MupWebService.WcfService.csproj
            else if(parsedProject.GetType() == typeof(CsProjToolVersion))
            {
                foreach(object toolsVersion in ((CsProjToolVersion)parsedProject).Items)
                {
                    if(toolsVersion.GetType() == typeof(Models.CsProjToolVersion.ProjectPropertyGroup))
                    {
                        var version = (Models.CsProjToolVersion.ProjectPropertyGroup)toolsVersion;
                        if(version.TargetFrameworkVersion != null)
                        {
                            return version.TargetFrameworkVersion;
                        }
                    }
                }
            }
            //$/Root/Cvh/Cvh.Katalog/Cvh.KatalogV2/Dev/Cvh.KatalogV2.Reporting/Cvh.KatalogV2.Reporting.csproj
            else if(parsedProject.GetType() == typeof(CsProjCoreVersionOne))
            {
                foreach(Models.CsProjCoreVersionOne.ProjectPropertyGroup currentProjectPropertyGroup in ((CsProjCoreVersionOne)parsedProject).PropertyGroup)
                {
                    if(currentProjectPropertyGroup.TargetFramework != null) return currentProjectPropertyGroup.TargetFramework;
                }
            }

            //$/Root/Inc.Blagajna/Inc.Blagajna.Mobile/Main/Inc.Blagajna.Mobile/Inc.Blagajna.Mobile.Droid/Inc.Blagajna.Mobile.Droid.csproj i Sample.csproj
            else if(parsedProject.GetType() == typeof(CsProjAndroid) || parsedProject.GetType() == typeof(CsProjAndroidSample))
            {
                return "Android projekt";
            }

            //$/Root/Cvh/Cvh.Stp/Utils/Cvh.Stp.UpdateWindowsService/UAB 2.0/QuickStarts/cs/AutoInproc/Client/AutoInproc/AutoInproc.csproj
            else if(parsedProject.GetType() == typeof(CsProjUnknown))
            {
                return "Nepoznat projekt";
                //Console.WriteLine("Nepoznat projekt, nije .NET framework");
            }

            throw new Exception("Nisam našao dobar project type");
        }

以上是关于csharp 来自csvj的getFrameworkVersion在tfvc上的主要内容,如果未能解决你的问题,请参考以下文章

csharp 保龄球比赛卡塔(来自鲍勃叔叔)

csharp Erik Johnson来自Epicor的BO和WCF

csharp 来自http://www.codemag.com/Article/1312081

csharp 来自http://www.codemag.com/Article/1312081

csharp 来自http://www.codemag.com/Article/1312081

csharp 来自http://www.codemag.com/Article/1312081