public static ProjectRootElement Create(string path, NewProjectFileOptions newProjectFileOptions) { return Create(path, ProjectCollection.GlobalProjectCollection, newProjectFileOptions); }
/// <summary> /// Initialize an in-memory, empty ProjectRootElement instance that can be saved later. /// Uses the specified project collection. /// </summary> public static ProjectRootElement Create(string path, ProjectCollection projectCollection, NewProjectFileOptions newProjectFileOptions) { ErrorUtilities.VerifyThrowArgumentLength(path, "path"); ErrorUtilities.VerifyThrowArgumentNull(projectCollection, "projectCollection"); ProjectRootElement projectRootElement = new ProjectRootElement(projectCollection.ProjectRootElementCache, newProjectFileOptions); projectRootElement.FullPath = path; return projectRootElement; }
public static ProjectRootElement Create(NewProjectFileOptions projectFileOptions) { return Create(ProjectCollection.GlobalProjectCollection, projectFileOptions); }
public static ProjectRootElement Create(ProjectCollection projectCollection, NewProjectFileOptions projectFileOptions) { ErrorUtilities.VerifyThrowArgumentNull(projectCollection, "projectCollection"); return Create(projectCollection.ProjectRootElementCache, projectFileOptions); }
internal static ProjectRootElement Create(ProjectRootElementCache projectRootElementCache, NewProjectFileOptions projectFileOptions) { return new ProjectRootElement(projectRootElementCache, projectFileOptions); }
/// <summary> /// Initialize an in-memory, empty ProjectRootElement instance that can be saved later. /// Leaves the project dirty, indicating there are unsaved changes. /// </summary> private ProjectRootElement(ProjectRootElementCache projectRootElementCache, NewProjectFileOptions projectFileOptions) { ErrorUtilities.VerifyThrowArgumentNull(projectRootElementCache, "projectRootElementCache"); _projectRootElementCache = projectRootElementCache; _directory = NativeMethodsShared.GetCurrentDirectory(); IncrementVersion(); XmlDocumentWithLocation document = new XmlDocumentWithLocation(); XmlReaderSettings xrs = new XmlReaderSettings(); xrs.DtdProcessing = DtdProcessing.Ignore; var emptyProjectFile = string.Format(EmptyProjectFileContent, (projectFileOptions & NewProjectFileOptions.IncludeXmlDeclaration) != 0 ? EmptyProjectFileXmlDeclaration : string.Empty, (projectFileOptions & NewProjectFileOptions.IncludeToolsVersion) != 0 ? EmptyProjectFileToolsVersion : string.Empty, (projectFileOptions & NewProjectFileOptions.IncludeXmlNamespace) != 0 ? EmptyProjectFileXmlNamespace : string.Empty); using (XmlReader xr = XmlReader.Create(new StringReader(emptyProjectFile), xrs)) { document.Load(xr); } ProjectParser.Parse(document, this); }
/// <summary> /// Adds a .targets file to the buildTransitive directory. /// </summary> /// <param name="project">Receives the <see cref="ProjectCreator" /> of the created project file.</param> /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .targets file.</param> /// <returns>The current <see cref="PackageRepository" />.</returns> public PackageRepository BuildTransitiveTargets(out ProjectCreator project, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions) { return(BuildTransitiveTargets(null, out project, projectFileOptions)); }
/// <summary> /// Adds a .targets file to the buildTransitive directory. /// </summary> /// <param name="creator">An <see cref="Action{ProjectCreator}" /> to generate the .targets file.</param> /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .targets file.</param> /// <returns>The current <see cref="PackageRepository" />.</returns> public PackageRepository BuildTransitiveTargets(Action <ProjectCreator> creator, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions) { return(BuildTransitiveTargets(creator, out _, projectFileOptions)); }
/// <summary> /// Adds a .targets file to the buildTransitive directory. /// </summary> /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .targets file.</param> /// <returns>The current <see cref="PackageRepository" />.</returns> public PackageRepository BuildTransitiveTargets(NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions) { return(BuildTransitiveTargets(out _, projectFileOptions)); }
/// <summary> /// Adds a .props file to the buildTransitive directory. /// </summary> /// <param name="creator">An <see cref="Action{ProjectCreator}" /> to generate the .props file.</param> /// <param name="project">Receives the <see cref="ProjectCreator" /> of the created project file.</param> /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .props file.</param> /// <returns>The current <see cref="PackageRepository" />.</returns> public PackageRepository BuildTransitiveProps(Action <ProjectCreator>?creator, out ProjectCreator project, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions) { CreateBuildFile(".props", "buildTransitive", creator, projectFileOptions, out project); return(this); }
/// <summary> /// Adds a .props file to the buildMultitargeting directory. /// </summary> /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .props file.</param> /// <returns>The current <see cref="PackageRepository" />.</returns> public PackageRepository BuildMultiTargetingProps(NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions) { return(BuildMultiTargetingProps(null, projectFileOptions)); }
/// <summary> /// Adds a .props file to the build directory. /// </summary> /// <param name="creator">An <see cref="Action{ProjectCreator}" /> to generate the .props file.</param> /// <param name="projectFileOptions">Optional <see cref="NewProjectFileOptions" /> for the .props file.</param> /// <returns>The current <see cref="PackageRepository" />.</returns> public PackageRepository BuildProps(Action <ProjectCreator> creator, NewProjectFileOptions projectFileOptions = NewProjectFileOptions.IncludeAllOptions) { return(BuildProps(creator, out ProjectCreator _, projectFileOptions)); }
public static ProjectCreator TestingOnlyTemplate(this ProjectCreatorTemplates template, NewProjectFileOptions projectFileOptions, string param1 = null, string param2 = null) { return(ProjectCreator.Create(projectFileOptions: projectFileOptions) .Import(param1, param2)); }