### Add Project to Solution with Optional Folder Source: https://github.com/microsoft/vs-solutionpersistence/wiki/Samples Adds a new project to a solution, optionally placing it within a specified solution folder. The project type can be inferred from the file extension, specified by a built-in name, or defined by a GUID. ```cs private static void AddProject(SolutionModel solution, string? solutionFolder, string projectFilePath) { SolutionFolderModel? parentSolutionFolder = null; if (solutionFolder is not null) { parentSolutionFolder = solution.AddFolder(solutionFolder); } // If the project type can be determined from the file extension, the project type name is optional. // If it cannot, a built-in name can be used, such as "Website" for a website project. // If it is not a built-in name, a project type can be added to the solution. // Finally the project type id guid can be used. string? projectTypeName = null; SolutionProjectModel newProject = solution.AddProject(projectFilePath, projectTypeName, parentSolutionFolder); } ``` -------------------------------- ### Invalid Project Entry in .sln File Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/test/Microsoft.VisualStudio.SolutionPersistence.Tests/SlnAssets/Invalid/InvalidProjectType.sln.txt This snippet shows a project definition within a Visual Studio solution file where the Project Type GUID is explicitly set to 'NotAGuid'. This indicates an invalid or unrecognized project type, which can cause the solution to fail to load correctly. ```plaintext Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.14.35819.311 MinimumVisualStudioVersion = 10.0.40219.1 Project("NotAGuid") = "InvalidProjectType", "InvalidProjectType.csproj", "{8A1FD751-4BAA-467E-A9FA-77239CA44A61}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CFB61351-9264-45B3-BBE0-BAC5D49C87CE} EndGlobalSection EndGlobal ``` -------------------------------- ### SolutionItemModel Methods Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Core methods and properties for all solution items. ```APIDOC ## MoveToFolder ### Description Moves the solution item to a specified folder. ### Method `MoveToFolder(SolutionFolderModel? folder)` ### Parameters - **folder** (SolutionFolderModel?) - Optional - The target folder to move the item to. If null, the item might be moved to the root. ``` -------------------------------- ### Read Project Build Configurations Source: https://github.com/microsoft/vs-solutionpersistence/wiki/Samples Iterates through projects in a solution to retrieve their build configurations and platforms. It identifies if a project is set to build or deploy for a specific solution configuration. ```cs private static void ReadEachProject(SolutionModel solution) { // Pick the first configuration in the solution. string buildConfiguration = solution.BuildTypes[0]; string buildPlatform = solution.Platforms[0]; foreach (SolutionProjectModel project in solution.SolutionProjects) { string projectFilePath = project.FilePath; // Find the project configuration for the solution build configuration and platform. (string? buildType, string? platform, bool build, bool deploy) = project.GetProjectConfiguration(buildConfiguration, buildPlatform); if (buildType is null || platform is null) { Console.WriteLine("Project {0} missing a configuration for {1}|{2}.", projectFilePath, buildConfiguration, buildPlatform); continue; } if (build) { Console.WriteLine("Project {0} is set to build as {1}|{2}.", projectFilePath, buildType, platform); } if (deploy) { Console.WriteLine("Project {0} is set to deploy as {1}|{2}.", projectFilePath, buildType, platform); } } } ``` -------------------------------- ### SolutionFolderModel Methods Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Methods for managing folders within a solution. ```APIDOC ## AddFile ### Description Adds a file to the solution folder. ### Method `AddFile(string file)` ### Parameters - **file** (string) - Required - The path of the file to add. ``` ```APIDOC ## RemoveFile ### Description Removes a file from the solution folder. ### Method `RemoveFile(string file)` ### Parameters - **file** (string) - Required - The path of the file to remove. ### Returns - `bool` - True if the file was successfully removed, false otherwise. ``` -------------------------------- ### SolutionModel Methods Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Methods for managing the overall solution. ```APIDOC ## AddBuildType ### Description Adds a new build type to the solution. ### Method `AddBuildType(string buildType)` ### Parameters - **buildType** (string) - Required - The name of the build type to add. ``` ```APIDOC ## AddFolder ### Description Adds a new folder to the solution at the specified path. ### Method `AddFolder(string path)` ### Parameters - **path** (string) - Required - The path for the new folder. ### Returns - `SolutionFolderModel` - The newly created solution folder. ``` ```APIDOC ## AddPlatform ### Description Adds a new platform configuration to the solution. ### Method `AddPlatform(string platform)` ### Parameters - **platform** (string) - Required - The name of the platform to add. ``` ```APIDOC ## AddProject ### Description Adds a project to the solution. ### Method `AddProject(string filePath, string? projectTypeName = null, SolutionFolderModel? folder = null)` ### Parameters - **filePath** (string) - Required - The path to the project file. - **projectTypeName** (string?) - Optional - The type of the project. - **folder** (SolutionFolderModel?) - Optional - The folder to place the project in. ### Returns - `SolutionProjectModel` - The newly added solution project. ``` ```APIDOC ## DistillProjectConfigurations ### Description Distills the project configurations within the solution. ### Method `DistillProjectConfigurations()` ``` ```APIDOC ## FindFolder ### Description Finds a solution folder by its path. ### Method `FindFolder(string path)` ### Parameters - **path** (string) - Required - The path of the folder to find. ### Returns - `SolutionFolderModel?` - The found solution folder, or null if not found. ``` ```APIDOC ## FindItemById ### Description Finds a solution item by its unique identifier. ### Method `FindItemById(Guid id)` ### Parameters - **id** (Guid) - Required - The unique identifier of the solution item. ### Returns - `SolutionItemModel?` - The found solution item, or null if not found. ``` -------------------------------- ### SolutionProjectModel Methods Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Methods for managing individual solution projects, including adding/removing dependencies, configuring project settings, and accessing project properties. ```APIDOC ## AddDependency ### Description Adds a dependency to the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.AddDependency(Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel! dependency) -> void` ## AddProjectConfigurationRule ### Description Adds a configuration rule to the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.AddProjectConfigurationRule(Microsoft.VisualStudio.SolutionPersistence.Model.ConfigurationRule rule) -> void` ## Dependencies.get ### Description Gets the read-only list of project dependencies. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.Dependencies.get -> System.Collections.Generic.IReadOnlyList?` ## DisplayName.get ### Description Gets the display name of the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.DisplayName.get -> string?` ## DisplayName.set ### Description Sets the display name of the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.DisplayName.set -> void` ## Extension.get ### Description Gets the file extension of the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.Extension.get -> string!` ## FilePath.get ### Description Gets the file path of the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.FilePath.get -> string!` ## FilePath.set ### Description Sets the file path of the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.FilePath.set -> void` ## GetProjectConfiguration ### Description Retrieves the build type, platform, build, and deploy settings for the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.GetProjectConfiguration(string! solutionBuildType, string! solutionPlatform) -> (string? BuildType, string? Platform, bool Build, bool Deploy)` ## ProjectConfigurationRules.get ### Description Gets the read-only list of project configuration rules. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.ProjectConfigurationRules.get -> System.Collections.Generic.IReadOnlyList?` ## ProjectConfigurationRules.set ### Description Sets the project configuration rules for the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.ProjectConfigurationRules.set -> void` ## RemoveDependency ### Description Removes a dependency from the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.RemoveDependency(Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel! dependency) -> bool` ## Type.get ### Description Gets the type of the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.Type.get -> string!` ## Type.set ### Description Sets the type of the project. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.Type.set -> void` ``` -------------------------------- ### SlnV12SerializerSettings Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Configuration settings for serializing solutions in the SlnV12 format. ```APIDOC ## SlnV12SerializerSettings ### Description Provides settings for controlling the serialization process of solutions in the SlnV12 format, such as encoding. ### Properties - **Encoding**: Gets or sets the encoding to use for the serialization. ### Constructors - **SlnV12SerializerSettings()**: Initializes a new instance with default settings. - **SlnV12SerializerSettings(SlnV12SerializerSettings settings)**: Initializes a new instance by copying settings from another instance. ``` -------------------------------- ### Convert Solution File to .slnx Source: https://github.com/microsoft/vs-solutionpersistence/wiki/Samples Converts a given solution file to the .slnx format. It checks if the file is a known solution type and handles potential syntax errors during the conversion process. ```cs private static async Task ConvertToSlnxAsync(string filePath, string slnxFilePath, CancellationToken cancellationToken) { // See if the file is a known solution file. ISolutionSerializer? serializer = SolutionSerializers.GetSerializerByMoniker(filePath); if (serializer is null) { return; } try { SolutionModel solution = await serializer.OpenAsync(filePath, cancellationToken); await SolutionSerializers.SlnXml.SaveAsync(slnxFilePath, solution, cancellationToken); } catch (SolutionException) { // There was an unrecoverable syntax error reading the solution file. return; } } ``` -------------------------------- ### SlnxSerializerSettings Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Configuration settings for serializing solutions in the Slnx (XML) format. ```APIDOC ## SlnxSerializerSettings ### Description Provides settings for controlling the serialization process of solutions in the Slnx (XML) format, including whitespace and newline characters. ### Properties - **IndentChars**: Gets or sets the characters used for indentation. - **NewLine**: Gets or sets the newline characters to use. - **PreserveWhitespace**: Gets or sets a value indicating whether to preserve whitespace. ### Constructors - **SlnxSerializerSettings()**: Initializes a new instance with default settings. - **SlnxSerializerSettings(SlnxSerializerSettings settings)**: Initializes a new instance by copying settings from another instance. ``` -------------------------------- ### SolutionModel Methods Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Methods for managing the overall solution model, including finding projects, accessing and modifying platforms, project types, and serializer extensions, as well as removing build types, folders, platforms, and projects. ```APIDOC ## FindProject ### Description Finds a project within the solution model by its path. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.FindProject(string! path) -> Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel?` ## Platforms.get ### Description Gets the read-only list of platforms available in the solution. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.Platforms.get -> System.Collections.Generic.IReadOnlyList!` ## ProjectTypes.get ### Description Gets the read-only list of project types in the solution. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.ProjectTypes.get -> System.Collections.Generic.IReadOnlyList!` ## ProjectTypes.set ### Description Sets the project types for the solution. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.ProjectTypes.set -> void` ## RemoveBuildType ### Description Removes a build type from the solution. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.RemoveBuildType(string! buildType) -> bool` ## RemoveFolder ### Description Removes a solution folder from the solution. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.RemoveFolder(Microsoft.VisualStudio.SolutionPersistence.Model.SolutionFolderModel! folder) -> bool` ## RemovePlatform ### Description Removes a platform from the solution. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.RemovePlatform(string! platform) -> bool` ## RemoveProject ### Description Removes a project from the solution. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.RemoveProject(Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel! project) -> bool` ## SerializerExtension.get ### Description Gets the serializer extension for the solution model. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.SerializerExtension.get -> Microsoft.VisualStudio.SolutionPersistence.Model.ISerializerModelExtension?` ## SerializerExtension.set ### Description Sets the serializer extension for the solution model. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.SerializerExtension.set -> void` ## SolutionFolders.get ### Description Gets the read-only list of solution folders. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.SolutionFolders.get -> System.Collections.Generic.IReadOnlyList!` ## SolutionItems.get ### Description Gets the read-only list of all solution items. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.SolutionItems.get -> System.Collections.Generic.IReadOnlyList!` ## SolutionModel() ### Description Initializes a new instance of the SolutionModel class. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.SolutionModel() -> void` ## SolutionModel(SolutionModel solutionModel) ### Description Initializes a new instance of the SolutionModel class with a copy of another solution model. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.SolutionModel(Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel! solutionModel) -> void` ## SolutionProjects.get ### Description Gets the read-only list of solution projects. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.SolutionProjects.get -> System.Collections.Generic.IReadOnlyList!` ## StringTable.get ### Description Gets the string table associated with the solution model. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.StringTable.get -> Microsoft.VisualStudio.SolutionPersistence.Model.StringTable!` ## StringTable.set ### Description Sets the string table for the solution model. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.StringTable.set -> void` ## VisualStudioProperties.get ### Description Gets the Visual Studio properties for the solution model. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel.VisualStudioProperties.get -> Microsoft.VisualStudio.SolutionPersistence.Model.VisualStudioProperties` ``` -------------------------------- ### ConfigurationRule Class Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Defines rules for solution configurations. ```APIDOC ## ConfigurationRule ### Description Represents a rule used for configuring solution builds. ### Constructors - **ConfigurationRule()**: Initializes a new instance of the ConfigurationRule class. - **ConfigurationRule(BuildDimension dimension, string solutionBuildType, string solutionPlatform, string projectValue)**: Initializes a new instance with specified build dimensions and values. ``` -------------------------------- ### ConfigurationRule Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Defines rules for configuration within the solution. ```APIDOC ## Dimension ### Description Gets the build dimension for the configuration rule. ### Method readonly get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.ConfigurationRule.Dimension -> Microsoft.VisualStudio.SolutionPersistence.Model.BuildDimension ``` ```APIDOC ## ProjectValue ### Description Gets the project value for the configuration rule. ### Method readonly get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.ConfigurationRule.ProjectValue -> string! ``` ```APIDOC ## SolutionBuildType ### Description Gets the solution build type for the configuration rule. ### Method readonly get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.ConfigurationRule.SolutionBuildType -> string! ``` ```APIDOC ## SolutionPlatform ### Description Gets the solution platform for the configuration rule. ### Method readonly get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.ConfigurationRule.SolutionPlatform -> string! ``` -------------------------------- ### Solution Serializers Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Provides access to various solution serializers and their settings. ```APIDOC ## GetSerializerByMoniker ### Description Retrieves a solution serializer based on its moniker. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SolutionSerializers.GetSerializerByMoniker(string! moniker) -> Microsoft.VisualStudio.SolutionPersistence.ISolutionSerializer? ``` ```APIDOC ## Serializers ### Description Gets a read-only collection of all available solution serializers. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SolutionSerializers.Serializers.get -> System.Collections.Generic.IReadOnlyCollection! ``` ```APIDOC ## SlnFileV12 ### Description Gets the serializer for the SlnFileV12 format with its specific settings. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SolutionSerializers.SlnFileV12.get -> Microsoft.VisualStudio.SolutionPersistence.ISolutionSingleFileSerializer! ``` ```APIDOC ## SlnXml ### Description Gets the serializer for the SlnXml (Slnx) format with its specific settings. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SolutionSerializers.SlnXml.get -> Microsoft.VisualStudio.SolutionPersistence.ISolutionSingleFileSerializer! ``` -------------------------------- ### SolutionItemModel Properties Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Properties available on SolutionItemModel. ```APIDOC ## SolutionItemModel ### Properties - **ActualDisplayName**: Gets the actual display name of the solution item. - **TypeId**: Gets the unique identifier for the type of the solution item. ``` -------------------------------- ### ISolutionSingleFileSerializer Interface Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Interface for serializers that handle solutions as single files with custom settings. ```APIDOC ## ISolutionSingleFileSerializer ### Description Interface for serializers that manage solutions stored as single files and support custom settings. ### Methods - **OpenAsync(Stream stream, CancellationToken cancellationToken)**: Asynchronously opens a solution from a stream. - **SaveAsync(Stream stream, SolutionModel model, CancellationToken cancellationToken)**: Asynchronously saves a solution to a stream. ### Properties - **DefaultFileExtension**: Gets the default file extension for this serializer. ``` -------------------------------- ### PropertyContainerModel Methods Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Methods for managing properties within a solution. ```APIDOC ## AddProperties ### Description Adds properties to a solution item identified by its ID. ### Method `AddProperties(string id, PropertiesScope scope = PropertiesScope.PreLoad)` ### Parameters - **id** (string) - Required - The identifier of the solution item. - **scope** (PropertiesScope) - Optional - The scope for the properties. Defaults to `PropertiesScope.PreLoad`. ### Returns - `SolutionPropertyBag` - The added or updated property bag. ``` ```APIDOC ## FindProperties ### Description Finds and retrieves properties associated with a specific solution item ID. ### Method `FindProperties(string id)` ### Parameters - **id** (string) - Required - The identifier of the solution item. ### Returns - `SolutionPropertyBag?` - The found property bag, or null if not found. ``` ```APIDOC ## RemoveProperties ### Description Removes properties associated with a given solution item ID. ### Method `RemoveProperties(string id)` ### Parameters - **id** (string) - Required - The identifier of the solution item. ### Returns - `bool` - True if the properties were successfully removed, false otherwise. ``` -------------------------------- ### SlnxSerializerSettings Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Settings for the Slnx serializer. ```APIDOC ## TrimVisualStudioProperties ### Description Gets or initializes a boolean value indicating whether to trim Visual Studio specific properties. ### Method get, init ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.Xml.SlnxSerializerSettings.TrimVisualStudioProperties.get -> bool? Microsoft.VisualStudio.SolutionPersistence.Serializer.Xml.SlnxSerializerSettings.TrimVisualStudioProperties.init -> void ``` -------------------------------- ### SlnV12 Extensions Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Provides extension methods for working with Solution Persistence in the SlnV12 format. ```APIDOC ## AddSlnProject ### Description Adds a solution project to the solution. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnV12Extensions.AddSlnProject(this Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel! solution, string! filePath, System.Guid projectTypeId, Microsoft.VisualStudio.SolutionPersistence.Model.SolutionFolderModel? folder) -> Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel! ``` ```APIDOC ## AddSlnProperties ### Description Adds solution properties to a solution item or the entire solution. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnV12Extensions.AddSlnProperties(this Microsoft.VisualStudio.SolutionPersistence.Model.SolutionItemModel! solutionItem, Microsoft.VisualStudio.SolutionPersistence.Model.SolutionPropertyBag? properties) -> bool Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnV12Extensions.AddSlnProperties(this Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel! solution, Microsoft.VisualStudio.SolutionPersistence.Model.SolutionPropertyBag? properties) -> bool ``` ```APIDOC ## CreateSlnFolder ### Description Creates a new solution folder within the solution. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnV12Extensions.CreateSlnFolder(this Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel! solution, string! name) -> Microsoft.VisualStudio.SolutionPersistence.Model.SolutionFolderModel! ``` ```APIDOC ## GetSlnProperties ### Description Retrieves solution properties for a solution item or the entire solution. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnV12Extensions.GetSlnProperties(this Microsoft.VisualStudio.SolutionPersistence.Model.SolutionItemModel! solutionItem) -> System.Collections.Generic.IEnumerable! Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnV12Extensions.GetSlnProperties(this Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel! solution) -> System.Collections.Generic.IEnumerable! ``` ```APIDOC ## SuspendProjectValidation ### Description Suspends project validation for the solution. Returns an IDisposable to manage the suspension. ### Method static ### Signature Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnV12Extensions.SuspendProjectValidation(this Microsoft.VisualStudio.SolutionPersistence.Model.SolutionModel! solution) -> System.IDisposable! ``` -------------------------------- ### Invalid Solution File with Duplicate Project ID Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/test/Microsoft.VisualStudio.SolutionPersistence.Tests/SlnAssets/Invalid/DuplicateProjectId.sln.txt This .sln file contains two project entries with the same Project ID. Visual Studio expects unique Project IDs for each project within a solution. ```plaintext Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.14.35819.311 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DuplicateProjectId", "DuplicateProjectId.csproj", "{8BADBEEF-1111-2222-3333-444444444444}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DuplicateProjectIdOpposite", "DuplicateProjectIdOpposite.csproj", "{8BADBEEF-1111-2222-3333-444444444444}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {8BADBEEF-1111-2222-3333-444444444444}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8BADBEEF-1111-2222-3333-444444444444}.Debug|Any CPU.Build.0 = Debug|Any CPU {8BADBEEF-1111-2222-3333-444444444444}.Release|Any CPU.ActiveCfg = Release|Any CPU {8BADBEEF-1111-2222-3333-444444444444}.Release|Any CPU.Build.0 = Release|Any CPU {8BADBEEF-1111-2222-3333-444444444444}.Debug|Any CPU.ActiveCfg = Release|Any CPU {8BADBEEF-1111-2222-3333-444444444444}.Debug|Any CPU.Build.0 = Release|Any CPU {8BADBEEF-1111-2222-3333-444444444444}.Release|Any CPU.ActiveCfg = Debug|Any CPU {8BADBEEF-1111-2222-3333-444444444444}.Release|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E0F1003A-31EB-42B8-8684-F82D497B9108} EndGlobalSection EndGlobal ``` -------------------------------- ### VisualStudioProperties Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Holds various properties related to Visual Studio and the solution configuration. ```APIDOC ## VisualStudioProperties ### Description Manages Visual Studio specific properties for a solution, including versioning, solution ID, and display settings. ### Properties - **HideSolutionNode**: Gets or sets a value indicating whether to hide the solution node. - **MinimumVersion**: Gets or sets the minimum required version for the solution. - **OpenWith**: Gets or sets the application to open the solution with. - **SolutionId**: Gets or sets the unique identifier for the solution. - **Version**: Gets or sets the version of the solution. ### Constructors - **VisualStudioProperties()**: Initializes a new instance of VisualStudioProperties. ``` -------------------------------- ### SolutionPropertyBag Methods Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Methods for managing properties within a solution property bag, including adding individual properties and ranges of properties. ```APIDOC ## Add ### Description Adds a property with a name and value to the property bag. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionPropertyBag.Add(string! name, string! value) -> void` ## AddRange ### Description Adds a collection of properties to the property bag. ### Method Signature `Microsoft.VisualStudio.SolutionPersistence.Model.SolutionPropertyBag.AddRange(System.Collections.Generic.IReadOnlyCollection>! properties) -> void` ``` -------------------------------- ### SolutionFolderModel Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Represents a solution folder in the model. ```APIDOC ## ActualDisplayName ### Description Gets the actual display name of the solution folder. ### Method override get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.SolutionFolderModel.ActualDisplayName.get -> string! ``` ```APIDOC ## TypeId ### Description Gets the unique identifier for the solution folder type. ### Method override get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.SolutionFolderModel.TypeId.get -> System.Guid ``` -------------------------------- ### ProjectType Class Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Represents a project type within a solution. ```APIDOC ## ProjectType ### Description Represents a specific type of project within a Visual Studio solution. ### Constructors - **ProjectType(Guid projectTypeId, IReadOnlyList rules)**: Initializes a new instance with a project type ID and a list of configuration rules. ### Properties - **BasedOn**: Gets or sets the name of the project type this one is based on. - **ConfigurationRules**: Gets a read-only list of configuration rules associated with this project type. - **Extension**: Gets or sets the file extension for this project type. - **Name**: Gets or sets the name of the project type. - **ProjectTypeId**: Gets the unique identifier for the project type. ``` -------------------------------- ### SolutionException Constructors Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Unshipped.txt Constructors for the SolutionException class, used for reporting errors during solution persistence. ```APIDOC ## SolutionException Constructors ### Description Provides methods to create `SolutionException` objects with specific error details. ### Constructors #### SolutionException(string message, SolutionErrorType errorType) ##### Description Initializes a new instance of the `SolutionException` class with a specified error message and error type. ##### Parameters - **message** (string) - Required - The error message that explains the reason for the exception. - **errorType** (SolutionErrorType) - Required - The type of error that occurred. #### SolutionException(string message, Exception inner, SolutionErrorType errorType) ##### Description Initializes a new instance of the `SolutionException` class with a specified error message, a reference to the inner exception that is the cause of the current exception, and the error type. ##### Parameters - **message** (string) - Required - The error message that explains the reason for the exception. - **inner** (Exception) - Required - The exception that is the cause of the current exception. If `inner` is not `null`, then the `InnerException` property of the current `SolutionException` is set to the `inner` exception. - **errorType** (SolutionErrorType) - Required - The type of error that occurred. ``` -------------------------------- ### SolutionProjectModel Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Represents a project within the solution model. ```APIDOC ## ActualDisplayName ### Description Gets the actual display name of the solution project. ### Method override get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.ActualDisplayName.get -> string! ``` ```APIDOC ## TypeId ### Description Gets the unique identifier for the solution project type. ### Method override get ### Signature Microsoft.VisualStudio.SolutionPersistence.Model.SolutionProjectModel.TypeId.get -> System.Guid ``` -------------------------------- ### ISolutionSerializer Interface Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Provides methods for serializing and deserializing Visual Studio solutions. ```APIDOC ## ISolutionSerializer ### Description Interface for serializing and deserializing Visual Studio solutions. ### Methods - **CreateModelExtension()**: Creates a new model extension for the serializer. - **IsSupported(string moniker)**: Checks if the serializer supports the given solution moniker. - **OpenAsync(string moniker, CancellationToken cancellationToken)**: Asynchronously opens a solution from a given moniker. - **SaveAsync(string moniker, SolutionModel model, CancellationToken cancellationToken)**: Asynchronously saves a solution to a given moniker. ### Properties - **Name**: Gets the name of the serializer. ``` -------------------------------- ### Merge Template Changes Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/CONTRIBUTING.md Use this script to fetch the latest changes from the template and merge them into your repository. Resolve any conflicts manually and then push the changes. ```powershell git fetch git checkout origin/main ./tools/MergeFrom-Template.ps1 # resolve any conflicts, then commit the merge commit. git push origin -u HEAD ``` -------------------------------- ### SolutionArgumentException Constructors Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Unshipped.txt Provides details on the constructors available for the SolutionArgumentException class, used for handling argument-related errors during solution persistence operations. ```APIDOC ## SolutionArgumentException Constructors ### Description These constructors are used to create instances of `SolutionArgumentException` to report errors related to invalid arguments passed to Solution Persistence operations. ### Constructors - **SolutionArgumentException(string? message, Microsoft.VisualStudio.SolutionPersistence.Model.SolutionErrorType type)** Initializes a new instance of the `SolutionArgumentException` class with a specified error message and error type. - **SolutionArgumentException(string? message, string? paramName, Microsoft.VisualStudio.SolutionPersistence.Model.SolutionErrorType type)** Initializes a new instance of the `SolutionArgumentException` class with a specified error message, the name of the parameter that causes this exception, and the error type. - **SolutionArgumentException(string? message, string? paramName, System.Exception? innerException, Microsoft.VisualStudio.SolutionPersistence.Model.SolutionErrorType type)** Initializes a new instance of the `SolutionArgumentException` class with a specified error message, the name of the parameter that causes this exception, the exception that is the cause of the current exception, and the error type. - **SolutionArgumentException(string? message, System.Exception? innerException, Microsoft.VisualStudio.SolutionPersistence.Model.SolutionErrorType type)** Initializes a new instance of the `SolutionArgumentException` class with a specified error message, the exception that is the cause of the current exception, and the error type. ``` -------------------------------- ### SolutionPropertyBag Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Represents a collection of properties associated with a solution. It allows for adding, retrieving, and managing key-value pairs of string properties. ```APIDOC ## SolutionPropertyBag ### Description Manages key-value string properties for a solution, with support for specifying scope and ID. ### Methods - **ContainsKey(string key)**: Checks if a property with the specified key exists. - **Count.get**: Gets the number of properties in the bag. - **GetEnumerator()**: Returns an enumerator for the properties. - **Keys.get**: Gets a collection of all property keys. - **PropertyNames.get**: Gets a read-only list of property names. - **Remove(string name)**: Removes the property with the specified name. - **Scope.get**: Gets the scope of the properties. - **TryGetValue(string key, out string value)**: Attempts to get the value associated with the key. - **Values.get**: Gets a collection of all property values. ### Constructors - **SolutionPropertyBag(string id, PropertiesScope scope = PropertiesScope.PreLoad)**: Initializes a new instance with a specified ID and scope. ``` -------------------------------- ### ISolutionSerializer Interface Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Generic interface for serializers that support custom settings. ```APIDOC ## ISolutionSerializer ### Description Generic interface for solution serializers that accept custom settings. ### Methods - **CreateModelExtension(TSettings settings)**: Creates a new model extension with the specified settings. ``` -------------------------------- ### StringTable Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt A utility class for managing and retrieving strings, potentially for localization or efficient string handling. ```APIDOC ## StringTable ### Description Provides methods for retrieving strings from a table. ### Methods - **GetString(string? str)**: Retrieves a string from the table. - **GetString(ReadOnlySpan str)**: Retrieves a string using a read-only span. ### Constructors - **StringTable()**: Initializes a new instance of the StringTable. ``` -------------------------------- ### BuildDimension Enum Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Represents different dimensions for building a solution. ```APIDOC ## BuildDimension ### Description Enumeration representing dimensions related to solution builds. ### Members - **Build**: Represents the build dimension. - **BuildType**: Represents the build type dimension. - **Deploy**: Represents the deploy dimension. - **Platform**: Represents the platform dimension. ``` -------------------------------- ### ISerializerModelExtension Interface Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Generic interface for model extensions with custom settings. ```APIDOC ## ISerializerModelExtension ### Description Generic interface for model extensions that include custom settings. ### Properties - **Settings**: Gets the settings associated with this model extension. ``` -------------------------------- ### PropertiesScope Enum Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Defines scopes for properties within the solution persistence model. ```APIDOC ## PropertiesScope ### Description Enumeration defining the scope for properties in the solution persistence model. ### Members - **PostLoad**: Indicates properties that are relevant after the solution has been loaded. ``` -------------------------------- ### ISerializerModelExtension Interface Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Shipped.txt Represents an extension to the serializer's model. ```APIDOC ## ISerializerModelExtension ### Description Represents an extension to the solution model that can be managed by a serializer. ### Properties - **Serializer**: Gets the serializer associated with this model extension. - **Tarnished**: Gets a value indicating whether the model extension has been modified. ``` -------------------------------- ### SolutionArgumentException Properties Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Unshipped.txt Details the properties of the SolutionArgumentException class, specifically the 'Type' property which indicates the nature of the argument error. ```APIDOC ## SolutionArgumentException Properties ### Description This section details the properties available on the `SolutionArgumentException` class. ### Properties - **Type** (`Microsoft.VisualStudio.SolutionPersistence.Model.SolutionErrorType`) Gets the type of the solution argument error. ``` -------------------------------- ### SolutionErrorType Enum Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Unshipped.txt Enumeration of possible error types that can occur during solution persistence operations, used with SolutionArgumentException. ```APIDOC ## SolutionErrorType Enum ### Description This enumeration defines the various types of errors that can be encountered during solution persistence operations. These are often used in conjunction with `SolutionArgumentException`. ### Members - **CannotMoveFolderToChildFolder** (1) - **DuplicateDefaultProjectType** (2) - **DuplicateExtension** (3) - **DuplicateItemRef** (4) - **DuplicateName** (5) - **DuplicateProjectName** (6) - **DuplicateProjectPath** (7) - **DuplicateProjectTypeId** (8) - **InvalidConfiguration** (9) - **InvalidEncoding** (10) - **InvalidFolderPath** (11) - **InvalidFolderReference** (12) - **InvalidItemRef** (13) - **InvalidLoop** (14) - **InvalidModelItem** (15) - **InvalidName** (16) - **InvalidProjectReference** (17) - **InvalidProjectTypeReference** (18) - **InvalidVersion** (19) - **MissingProjectValue** (20) - **NotSolution** (21) - **InvalidXmlDecoratorElementName** (23) ``` -------------------------------- ### SolutionErrorType Enum Source: https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/PublicAPI/PublicAPI.Unshipped.txt Defines the types of errors that can occur during solution persistence operations. ```APIDOC ## SolutionErrorType Enum ### Description Enumeration representing different types of errors encountered in solution persistence. ### Members - **Undefined**: Represents an undefined or unknown error type. - **UnsupportedVersion**: Indicates that the solution version is not supported. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.