public static StandardProjectType GetStandardType(string projectFile) { StandardProjectType projectType = StandardProjectType.None; if (String.IsNullOrEmpty(projectFile)) { return(projectType); } string fileExt = Path.GetExtension(projectFile); if (String.IsNullOrEmpty(fileExt)) { return(projectType); } switch (fileExt.ToLower()) { case ".csproj": projectType = StandardProjectType.CsProj; break; case ".vbproj": projectType = StandardProjectType.VbProj; break; case ".fsproj": projectType = StandardProjectType.FsProj; break; case ".pyproj": projectType = StandardProjectType.PyProj; break; case ".rbproj": projectType = StandardProjectType.RbProj; break; case ".vjsproj": projectType = StandardProjectType.VjsProj; break; } return(projectType); }
public override bool Parse(ProjectSectionContext context, string projectFile) { _standardType = StandardProjectType.None; if (!base.Parse(context, projectFile)) { return(false); } _standardType = ProjectSectionFactory.GetStandardType(projectFile); bool isSuccessful = this.ParseProperties(); if (!isSuccessful) { // If not successful, we try parsing "Choose" elements, since the ff. // is equally valid as conditioned property group.... //<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> // <PropertyGroup> // <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> // <OutputType>Exe</OutputType> // <RootNamespace>Application1</RootNamespace> // <AssemblyName>Application1</AssemblyName> // <WarningLevel>4</WarningLevel> // </PropertyGroup> // <Choose> // <When Condition=" '$(Configuration)'=='debug' "> // <PropertyGroup> // <OutputPath>.\bin\Debug\</OutputPath> // </PropertyGroup> // </When> // <When Condition=" '$(Configuration)'=='retail' "> // <PropertyGroup> // <OutputPath>.\bin\Release\</OutputPath> // </PropertyGroup> // </When> // <Otherwise> // <PropertyGroup> // <OutputPath>.\bin\$(Configuration)\</OutputPath> // </PropertyGroup> // </Otherwise> // </Choose> //</Project> isSuccessful = this.ParseChoose(); } if (!isSuccessful) { return(isSuccessful); } List <ProjectInfo> referencedProjects = new List <ProjectInfo>(); isSuccessful = this.ParseReferenceItems(referencedProjects); this.CreateChildren(referencedProjects); return(isSuccessful); }
public StandardProjectSection() { _standardType = StandardProjectType.None; }