/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == 'Bari|Bari' "); WriteConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); // Writing out configuration specific part to the non conditional block as well WriteConfigurationSpecificPart(writer, project); writer.WriteElementString("OutputType", GetOutputType(project.Type)); writer.WriteElementString("AssemblyName", project.Name); writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B")); CsharpProjectParameters parameters = project.GetInheritableParameters<CsharpProjectParameters, CsharpProjectParametersDef>("csharp"); parameters.FillProjectSpecificMissingInfo(project); parameters.ToCsprojProperties(writer); WriteAppConfig(writer, project); WriteManifest(writer, project); WriteApplicationIcon(writer, project, parameters); writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { var csRoot = project.RootDirectory.GetChildDirectory("cs"); if (csRoot != null) { var serviceReferencesRoot = csRoot.GetChildDirectory("Service References"); if (serviceReferencesRoot != null) { writer.WriteStartElement("ItemGroup"); writer.WriteStartElement("WCFMetadata"); writer.WriteAttributeString("Include", "Service References" + Path.DirectorySeparatorChar); writer.WriteEndElement(); foreach (var child in serviceReferencesRoot.ChildDirectories) { writer.WriteStartElement("WCFMetadataStorage"); writer.WriteAttributeString("Include", "Service References\\" + child + Path.DirectorySeparatorChar); writer.WriteEndElement(); } writer.WriteEndElement(); } } }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("ItemGroup"); var orderedFiles = GetOrderedFiles(project); foreach (var pair in orderedFiles) { var file = pair.Item1; var sourceSetType = pair.Item2; var relativePath = ToProjectRelativePath(project, file, ProjectSourceSetName); var logicalPath = GetLogicalPath(project, file, sourceSetType); // We have to skip .csproj files, which are generated by bari to the source set because otherwise // VisualStudio does not work as expected: if (!IgnoredExtensions.Any(ext => relativePath.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))) { writer.WriteStartElement(GetElementNameFor(project, file)); writer.WriteAttributeString("Include", relativePath); if (ProjectSourceSetName != sourceSetType) { writer.WriteElementString("LogicalName", logicalPath); } WriteAdditionalOptions(writer, project, file); writer.WriteEndElement(); } } writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("ItemGroup"); foreach (var refPath in context.References) { if (((string)refPath).StartsWith("SLN!")) { var moduleAndprojectName = ((string)refPath).Substring(4); var parts = moduleAndprojectName.Split('#'); var moduleName = parts[0]; var projectName = parts[1]; var referredProject = Suite.GetModule(moduleName).GetProjectOrTestProject(projectName); if (referredProject.Type == ProjectType.StaticLibrary) { writer.WriteStartElement("ProjectReference"); writer.WriteAttributeString("Include", ToProjectRelativePath(project, Path.Combine(Suite.SuiteRoot.GetRelativePath(referredProject.RootDirectory), "cpp", projectName + ".vcxproj"), "cpp")); writer.WriteElementString("Project", projectGuidManagement.GetGuid(project).ToString("B")); writer.WriteEndElement(); } } } writer.WriteEndElement(); }
public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { // TODO: merge common code with C# PropertiesSection writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == 'Bari|Bari' "); WriteConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); WriteConfigurationSpecificPart(writer, project); writer.WriteElementString("OutputType", GetOutputType(project.Type)); writer.WriteElementString("AssemblyName", project.Name); writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B")); FsharpProjectParameters parameters = project.HasParameters("fsharp") ? project.GetParameters<FsharpProjectParameters>("fsharp") : new FsharpProjectParameters(Suite); parameters.FillProjectSpecificMissingInfo(project); parameters.ToFsprojProperties(writer); writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("ItemGroup"); var orderedFiles = GetOrderedFiles(project); foreach (var pair in orderedFiles) { var file = pair.Item1; var sourceSetType = pair.Item2; var relativePath = ToProjectRelativePath(project, file, ProjectSourceSetName); var logicalPath = GetLogicalPath(project, file, sourceSetType); // We have to skip .csproj files, which are generated by bari to the source set because otherwise // VisualStudio does not work as expected: if (!IgnoredExtensions.Any(ext => relativePath.EndsWith(ext, StringComparison.InvariantCultureIgnoreCase))) { writer.WriteStartElement(GetElementNameFor(project, file)); writer.WriteAttributeString("Include", relativePath); if (ProjectSourceSetName != sourceSetType) writer.WriteElementString("LogicalName", logicalPath); WriteAdditionalOptions(writer, project, file); writer.WriteEndElement(); } } writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == 'Bari|Bari' "); WriteConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); // Writing out configuration specific part to the non conditional block as well WriteConfigurationSpecificPart(writer, project); writer.WriteElementString("OutputType", GetOutputType(project.Type)); writer.WriteElementString("AssemblyName", project.Name); writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B")); CsharpProjectParameters parameters = project.GetInheritableParameters <CsharpProjectParameters, CsharpProjectParametersDef>("csharp"); parameters.FillProjectSpecificMissingInfo(project); parameters.ToCsprojProperties(writer); WriteAppConfig(writer, project); if (!WriteWin32Resource(writer, project)) { WriteManifest(writer, project); WriteApplicationIcon(writer, project, parameters); } writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("ItemGroup"); foreach (var refPath in context.References) { if (((string) refPath).StartsWith("SLN!")) { var moduleAndprojectName = ((string) refPath).Substring(4); var parts = moduleAndprojectName.Split('#'); var moduleName = parts[0]; var projectName = parts[1]; var referredProject = Suite.GetModule(moduleName).GetProjectOrTestProject(projectName); if (referredProject.Type == ProjectType.StaticLibrary) { writer.WriteStartElement("ProjectReference"); writer.WriteAttributeString("Include", ToProjectRelativePath(project, Path.Combine(Suite.SuiteRoot.GetRelativePath(referredProject.RootDirectory), "cpp", projectName+".vcxproj"), "cpp")); writer.WriteElementString("Project", projectGuidManagement.GetGuid(project).ToString("B")); writer.WriteEndElement(); } } } writer.WriteEndElement(); }
public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { // TODO: merge common code with C# PropertiesSection writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", " '$(Configuration)|$(Platform)' == 'Bari|Bari' "); WriteConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); WriteConfigurationSpecificPart(writer, project); writer.WriteElementString("OutputType", GetOutputType(project.Type)); writer.WriteElementString("AssemblyName", project.Name); writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B")); FsharpProjectParameters parameters = project.HasParameters("fsharp") ? project.GetParameters <FsharpProjectParameters>("fsharp") : new FsharpProjectParameters(Suite); parameters.FillProjectSpecificMissingInfo(project); parameters.ToFsprojProperties(writer); writer.WriteEndElement(); }
public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { var platform = platformManagement.GetDefaultPlatform(project); var cliMode = project.GetCLIMode(); writer.WriteStartElement("ItemGroup"); writer.WriteAttributeString("Label", "ProjectConfigurations"); writer.WriteStartElement("ProjectConfiguration"); writer.WriteAttributeString("Include", string.Format("Bari|{0}", platform)); writer.WriteElementString("Configuration", "Bari"); writer.WriteElementString("Platform", platform); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Label", "Globals"); writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B")); if (cliMode == CppCliMode.Disabled) { writer.WriteElementString("Keyword", "Win32Proj"); } else { VCppProjectCompilerParameters compilerParameters = project.GetInheritableParameters <VCppProjectCompilerParameters, VCppProjectCompilerParametersDef>("cpp-compiler"); compilerParameters.WriteGlobalProperties(writer); writer.WriteElementString("Keyword", "ManagedCProj"); writer.WriteElementString("RootNamespace", project.Name); } writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", string.Format("'$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform)); writer.WriteAttributeString("Label", "Configuration"); WriteHighLevelConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("Import"); writer.WriteAttributeString("Project", @"$(VCTargetsPath)\Microsoft.Cpp.props"); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", string.Format("'$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform)); WriteConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("ItemDefinitionGroup"); writer.WriteAttributeString("Condition", string.Format(" '$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform)); WriteMIDLParameters(writer, project); WriteCompilerParameters(writer, project); WriteLinkerParameters(writer, project); WriteManifestParameters(writer, project); WriteResourceCompilerParameters(writer, project); writer.WriteEndElement(); }
public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { var platform = platformManagement.GetDefaultPlatform(project); var cliMode = GetCLIMode(project); writer.WriteStartElement("ItemGroup"); writer.WriteAttributeString("Label", "ProjectConfigurations"); writer.WriteStartElement("ProjectConfiguration"); writer.WriteAttributeString("Include", string.Format("Bari|{0}", platform)); writer.WriteElementString("Configuration", "Bari"); writer.WriteElementString("Platform", platform); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Label", "Globals"); writer.WriteElementString("ProjectGuid", projectGuidManagement.GetGuid(project).ToString("B")); if (cliMode == CppCliMode.Disabled) { writer.WriteElementString("Keyword", "Win32Proj"); } else { VCppProjectCompilerParameters compilerParameters = project.GetInheritableParameters<VCppProjectCompilerParameters, VCppProjectCompilerParametersDef>("cpp-compiler"); compilerParameters.WriteGlobalProperties(writer); writer.WriteElementString("Keyword", "ManagedCProj"); writer.WriteElementString("RootNamespace", project.Name); } writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", string.Format("'$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform)); writer.WriteAttributeString("Label", "Configuration"); WriteHighLevelConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("Import"); writer.WriteAttributeString("Project", @"$(VCTargetsPath)\Microsoft.Cpp.props"); writer.WriteEndElement(); writer.WriteStartElement("PropertyGroup"); writer.WriteAttributeString("Condition", string.Format("'$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform)); WriteConfigurationSpecificPart(writer, project); writer.WriteEndElement(); writer.WriteStartElement("ItemDefinitionGroup"); writer.WriteAttributeString("Condition", string.Format(" '$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform)); WriteMIDLParameters(writer, project); WriteCompilerParameters(writer, project); WriteLinkerParameters(writer, project); WriteManifestParameters(writer, project); WriteResourceCompilerParameters(writer, project); writer.WriteEndElement(); }
public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { if (project.HasParameters("contracts")) { writer.WriteStartElement("PropertyGroup"); var parameters = project.GetParameters<ContractsProjectParameters>("contracts"); parameters.ToCsprojProperties(writer); writer.WriteEndElement(); } }
public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { if (project.HasParameters("contracts")) { writer.WriteStartElement("PropertyGroup"); var parameters = project.GetParameters <ContractsProjectParameters>("contracts"); parameters.ToCsprojProperties(writer); writer.WriteEndElement(); } }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("ItemGroup"); foreach (var refPath in context.References.Where(IsValidReference)) { if (IsSolutionReference(refPath)) { var moduleAndprojectName = ((string) refPath).Substring(4); var parts = moduleAndprojectName.Split('#'); var moduleName = parts[0]; var projectName = parts[1]; var referredProject = Suite.GetModule(moduleName).GetProjectOrTestProject(projectName); if (referredProject.Type == ProjectType.Library || referredProject.Type == ProjectType.Executable) { writer.WriteComment("Project reference " + projectGuidManagement.GetGuid(referredProject)); writer.WriteStartElement("Reference"); writer.WriteAttributeString("Include", projectName); writer.WriteElementString("HintPath", ToProjectRelativePath(project, Path.Combine(Suite.SuiteRoot.GetRelativePath(targetDir), referredProject.Module.Name, referredProject.Name + ".dll"), sourceSetName)); writer.WriteElementString("SpecificVersion", "False"); writer.WriteEndElement(); } } else { writer.WriteStartElement("Reference"); if (IsGACReference(refPath)) { var assemblyName = ((string) refPath).Substring(4); writer.WriteAttributeString("Include", assemblyName); } else { string relativePath = ToProjectRelativePath(project, Path.Combine("target", refPath), sourceSetName); writer.WriteAttributeString("Include", Path.GetFileNameWithoutExtension(relativePath)); writer.WriteElementString("HintPath", relativePath); writer.WriteElementString("SpecificVersion", "False"); writer.WriteElementString("Private", "True"); } writer.WriteEndElement(); } } writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { writer.WriteStartElement("ItemGroup"); foreach (var refPath in context.References.Where(IsValidReference)) { if (IsSolutionReference(refPath)) { var moduleAndprojectName = ((string)refPath).Substring(4); var parts = moduleAndprojectName.Split('#'); var moduleName = parts[0]; var projectName = parts[1]; var referredProject = Suite.GetModule(moduleName).GetProjectOrTestProject(projectName); if (referredProject.Type == ProjectType.Library || referredProject.Type == ProjectType.Executable) { writer.WriteComment("Project reference " + projectGuidManagement.GetGuid(referredProject)); writer.WriteStartElement("Reference"); writer.WriteAttributeString("Include", projectName); writer.WriteElementString("HintPath", ToProjectRelativePath(project, Path.Combine(Suite.SuiteRoot.GetRelativePath(targetDir), referredProject.Module.Name, referredProject.Name + ".dll"), sourceSetName)); writer.WriteElementString("SpecificVersion", "False"); writer.WriteEndElement(); } } else { writer.WriteStartElement("Reference"); if (IsGACReference(refPath)) { var assemblyName = ((string)refPath).Substring(4); writer.WriteAttributeString("Include", assemblyName); } else { string relativePath = ToProjectRelativePath(project, Path.Combine("target", refPath), sourceSetName); writer.WriteAttributeString("Include", Path.GetFileNameWithoutExtension(relativePath)); writer.WriteElementString("HintPath", relativePath); writer.WriteElementString("SpecificVersion", "False"); writer.WriteElementString("Private", "True"); } writer.WriteEndElement(); } } writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { // Generating the version file (C# source code) var generator = new CsharpVersionInfoGenerator(project); generator.Generate(context.VersionOutput); // Adding reference to it to the .csproj file writer.WriteStartElement("ItemGroup"); writer.WriteStartElement("Compile"); writer.WriteAttributeString("Include", "..\\"+context.VersionFileName); writer.WriteElementString("Link", "_Generated\\version.cs"); writer.WriteEndElement(); writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context) { // Generating the version file (C# source code) var generator = new CsharpVersionInfoGenerator(project); generator.Generate(context.VersionOutput); // Adding reference to it to the .csproj file writer.WriteStartElement("ItemGroup"); writer.WriteStartElement("Compile"); writer.WriteAttributeString("Include", "..\\" + context.VersionFileName); writer.WriteElementString("Link", "_Generated\\version.cs"); writer.WriteEndElement(); writer.WriteEndElement(); }
/// <summary> /// Writes the section using an XML writer /// </summary> /// <param name="writer">XML writer to use</param> /// <param name="project">The project to generate .csproj for</param> /// <param name="context">Current .csproj generation context</param> public abstract void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context);