protected override string GenerateProjectFiles(string solutionDirectoryPath, Guid solutionGuid) { string csprojDirectoryPath = Path.Combine(solutionDirectoryPath, AssemblyName); DirectoryInfo csprojDirectory = Directory.CreateDirectory(csprojDirectoryPath); tempCsProjDirectoryPath = csprojDirectoryPath; AddProjectFilesAndFolders(this, csprojDirectoryPath); var xmlNode = new XElement(xNamespace + "Project", new XAttribute("ToolsVersion", "4.0"), new XAttribute("DefaultTargets", "Build"), new XAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"), new XElement(xNamespace + "PropertyGroup", new XElement(xNamespace + "Configuration", new XAttribute("Condition", " '$(Configuration)' == '' "), new XText(DEFAULT_BUILD_CONFIGURATION) ), new XElement(xNamespace + "Platform", new XAttribute("Condition", " '$(Platform)' == '' "), new XText(DEFAULT_BUILD_PLATFORM) ), new XElement(xNamespace + "ProjectGuid", new XText(String.Concat("{", AssemblyGuid.ToString(), "}")) ), new XElement(xNamespace + "ProjectTypeGuids", new XText($"{{{ProjectTypeGuids.Xamarin_Android}}};{{{ProjectTypeGuids.Cs}}}") ), //new XElement(xNamespace + "TemplateGuid" //), new XElement(xNamespace + "OutputType", new XText(OutputType) ), new XElement(xNamespace + "RootNamespace", new XText(RootNamespace) ), new XElement(xNamespace + "AssemblyName", new XText(AssemblyName) ), new XElement(xNamespace + "AndroidApplication", new XText("True") ), new XElement(xNamespace + "AndroidResgenFile", new XText(@"Resources\Resource.designer.cs") ), new XElement(xNamespace + "AndroidResgenClass", new XText("Resource") ), new XElement(xNamespace + "AndroidManifest", new XText(@"Properties\AndroidManifest.xml") ), new XElement(xNamespace + "MonoAndroidResourcePrefix", new XText("Resources") ), new XElement(xNamespace + "MonoAndroidAssetsPrefix", new XText("Assets") ), new XElement(xNamespace + "AndroidUseLatestPlatformSdk", new XText("false") ), new XElement(xNamespace + "TargetFrameworkVersion", new XText(TargetFrameworkVersion.TargetVersion) ), new XElement(xNamespace + "AndroidHttpClientHandlerType", new XText("Xamarin.Android.Net.AndroidClientHandler") ) ), // END PROPERTY GROUP GetBuildConfigurationPropertyGroups(xNamespace), GetAssemblyReferenceItemGroup(), GetNugetReferenceItemGroup(), GetProjectReferenceItemGroup(), GetCompileFilesItemGroup(), GetOtherFileItemGroup(), GetContentFilesItemGroup(), GetNoneFilesItemGroup(), GetAndroidResourceFilesItemGroup(), GetProjectFoldersItemGroup(), //GetCustomFilesItemGroups(xNamespace), GetImportProjectItems(xNamespace) //GetTargetItems(xNamespace), //GetPreBuildEventPropertyGroups(xNamespace), //GetPostBuildEventPropertyGroups(xNamespace) ); // END PROJECT string csprojFilePath = Path.Combine(csprojDirectoryPath, String.Concat(AssemblyName, ".csproj")); xmlNode.Save(csprojFilePath); return(csprojFilePath); }
protected override string GenerateProjectFiles(string solutionDirectoryPath, Guid solutionGuid) { string csprojDirectoryPath = Path.Combine(solutionDirectoryPath, AssemblyName); DirectoryInfo csprojDirectory = Directory.CreateDirectory(csprojDirectoryPath); tempCsProjDirectoryPath = csprojDirectoryPath; AddProjectFilesAndFolders(this, csprojDirectoryPath); var xmlNode = new XElement(xNamespace + "Project", new XAttribute("ToolsVersion", "4.0"), new XAttribute("DefaultTargets", "Build"), new XAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"), new XElement(xNamespace + "PropertyGroup", new XElement(xNamespace + "Configuration", new XAttribute("Condition", " '$(Configuration)' == '' "), new XText(DEFAULT_BUILD_CONFIGURATION) ), new XElement(xNamespace + "Platform", new XAttribute("Condition", " '$(Platform)' == '' "), new XText("iPhoneSimulator") ), new XElement(xNamespace + "ProductVersion", new XText(TargetFrameworkVersion.TargetVersion) ), new XElement(xNamespace + "SchemaVersion", new XText(((XamariniOSPlatform)TargetFrameworkVersion).SchemaVersion) ), new XElement(xNamespace + "ProjectGuid", new XText(String.Concat("{", AssemblyGuid.ToString(), "}")) ), new XElement(xNamespace + "ProjectTypeGuids", new XText($"{{{ProjectTypeGuids.Xamarin_iOS}}};{{{ProjectTypeGuids.Cs}}}") ), //new XElement(xNamespace + "TemplateGuid" //), new XElement(xNamespace + "OutputType", new XText(OutputType) ), new XElement(xNamespace + "RootNamespace", new XText(RootNamespace) ), new XElement(xNamespace + "AssemblyName", new XText(AssemblyName) ), new XElement(xNamespace + "IPhoneResourcePrefix", new XText("Resources") ), new XElement(xNamespace + "MtouchHttpClientHandler", new XText("NSUrlSessionHandler") ) ), // END PROPERTY GROUP GetBuildConfigurationPropertyGroups(xNamespace), GetAssemblyReferenceItemGroup(), GetNugetReferenceItemGroup(), GetProjectReferenceItemGroup(), GetCompileFilesItemGroup(), GetOtherFileItemGroup(), GetContentFilesItemGroup(), GetNoneFilesItemGroup(), //GetImageAssetFilesItemGroup(), GetProjectFoldersItemGroup(), GetImportProjectItems(xNamespace) ); // END PROJECT string csprojFilePath = Path.Combine(csprojDirectoryPath, String.Concat(AssemblyName, ".csproj")); xmlNode.Save(csprojFilePath); return(csprojFilePath); }
protected override string GenerateProjectFiles(string solutionDirectoryPath, Guid solutionGuid) { string csprojDirectoryPath = Path.Combine(solutionDirectoryPath, AssemblyName); DirectoryInfo csprojDirectory = Directory.CreateDirectory(csprojDirectoryPath); tempCsProjDirectoryPath = csprojDirectoryPath; CreatePackageConfig(); AddProjectFilesAndFolders(this, csprojDirectoryPath); // create csproj file using xmlwriter //using (XmlWriter writer = XmlWriter.Create(String.Concat(AssemblyName, ".csproj"))) //{ // writer.WriteStartDocument(); //} //XmlDocument doc = new XmlDocument(); //XmlElement root = doc.CreateElement("Project"); //root.SetAttribute("ToolsVersion", "14.0"); //root.SetAttribute("DefaultTargets", "Build"); //root.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); var xmlNode = new XElement(xNamespace + "Project", new XAttribute("ToolsVersion", "14.0"), new XAttribute("DefaultTargets", "Build"), new XAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"), new XElement(xNamespace + "Import", new XAttribute("Project", @"$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"), new XAttribute("Condition", @"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')") ), new XElement(xNamespace + "PropertyGroup", new XElement(xNamespace + "Configuration", new XAttribute("Condition", " '$(Configuration)' == '' "), new XText(DEFAULT_BUILD_CONFIGURATION) ), new XElement(xNamespace + "Platform", new XAttribute("Condition", " '$(Platform)' == '' "), new XText(DEFAULT_BUILD_PLATFORM) ), new XElement(xNamespace + "ProjectGuid", new XText(String.Concat("{", AssemblyGuid.ToString(), "}")) ), new XElement(xNamespace + "OutputType", new XText(OutputType) ), new XElement(xNamespace + "AppDesignerFolder", new XText("Properties") ), new XElement(xNamespace + "RootNamespace", new XText(RootNamespace) ), new XElement(xNamespace + "AssemblyName", new XText(AssemblyName) ), new XElement(xNamespace + "TargetFrameworkVersion", new XText(TargetFrameworkVersion.TargetVersion) ), new XElement(xNamespace + "FileAlignment", new XText("512") ), GetProjectSpecificPropertyNodes(xNamespace, solutionGuid), new XElement(xNamespace + "TargetFrameworkProfile", new XText(((NetFrameworkPlatform)TargetFrameworkVersion).Profile ?? String.Empty) ) ), // END PROPERTY GROUP GetBuildConfigurationPropertyGroups(xNamespace), GetAssemblyReferenceItemGroup(), GetProjectReferenceItemGroup(), GetCompileFilesItemGroup(), GetOtherFileItemGroup(), GetContentFilesItemGroup(), GetNoneFilesItemGroup(), GetProjectFoldersItemGroup(), GetCustomFilesItemGroups(xNamespace), GetImportProjectItems(xNamespace), GetTargetItems(xNamespace), GetPreBuildEventPropertyGroups(xNamespace), GetPostBuildEventPropertyGroups(xNamespace) ); // END PROJECT string csprojFilePath = Path.Combine(csprojDirectoryPath, String.Concat(AssemblyName, ".csproj")); xmlNode.Save(csprojFilePath); return(csprojFilePath); }