#visual-studio #solution #parser #microsoft #sln

solp

Microsoft Visual Studio解决方案解析库

81个版本

0.16.5 2024年7月5日
0.16.0 2024年2月26日
0.15.3 2023年10月20日
0.10.1 2023年7月30日
0.3.3 2021年3月23日

#13 in #visual-studio

Download history 1/week @ 2024-05-25 1/week @ 2024-06-01 288/week @ 2024-06-08 159/week @ 2024-06-15 19/week @ 2024-06-22 73/week @ 2024-06-29 81/week @ 2024-07-06 3/week @ 2024-07-13 70/week @ 2024-07-27

每月 227 次下载
用于 solv

MIT 协议

115KB
2K SLoC

solp

一个用于解析Microsoft Visual Studio解决方案文件的库

MIT许可

文档

https://docs.rs/solp

使用

运行 cargo add solp 自动将此crate添加到您的 Cargo.toml 文件中的依赖项。

示例

use solp::parse_str;

let solution = r#"Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project", "Project\Project.csproj", "{93ED4C31-2F29-49DB-88C3-AEA9AF1CA52D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project.Test", "Project.Test\Project.Test.csproj", "{D5BBB06B-B46F-4342-A262-C569D4D2967C}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{93ED4C31-2F29-49DB-88C3-AEA9AF1CA52D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{93ED4C31-2F29-49DB-88C3-AEA9AF1CA52D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{93ED4C31-2F29-49DB-88C3-AEA9AF1CA52D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{93ED4C31-2F29-49DB-88C3-AEA9AF1CA52D}.Release|Any CPU.Build.0 = Release|Any CPU
		{D5BBB06B-B46F-4342-A262-C569D4D2967C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{D5BBB06B-B46F-4342-A262-C569D4D2967C}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{D5BBB06B-B46F-4342-A262-C569D4D2967C}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{D5BBB06B-B46F-4342-A262-C569D4D2967C}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
EndGlobal"#;

let result = parse_str(solution);

assert!(result.is_ok());

将解析的解决方案表示为JSON结构

{
  "path": "",
  "format": "12.00",
  "product": "",
  "versions": [],
  "projects": [
    {
      "type_id": "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}",
      "type_description": "C#",
      "id": "{93ED4C31-2F29-49DB-88C3-AEA9AF1CA52D}",
      "name": "Project",
      "path_or_uri": "Project\\Project.csproj",
      "configurations": [
        {
          "configuration": "Debug",
          "solution_configuration": "Debug",
          "platform": "Any CPU",
          "tags": [
            "Build"
          ]
        },
        {
          "configuration": "Release",
          "solution_configuration": "Release",
          "platform": "Any CPU",
          "tags": [
            "Build"
          ]
        }
      ]
    },
    {
      "type_id": "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}",
      "type_description": "C#",
      "id": "{D5BBB06B-B46F-4342-A262-C569D4D2967C}",
      "name": "Project.Test",
      "path_or_uri": "Project.Test\\Project.Test.csproj",
      "configurations": [
        {
          "configuration": "Debug",
          "solution_configuration": "Debug",
          "platform": "Any CPU",
          "tags": [
            "Build"
          ]
        },
        {
          "configuration": "Release",
          "solution_configuration": "Release",
          "platform": "Any CPU",
          "tags": [
            "Build"
          ]
        }
      ]
    }
  ],
  "configurations": [
    {
      "configuration": "Debug",
      "platform": "Any CPU"
    },
    {
      "configuration": "Release",
      "platform": "Any CPU"
    }
  ]
}

最小Rust版本策略

此crate支持的最小rustc版本是1.70.0

当前策略是,用于使用此crate所需的最小Rust版本可以在小版本更新中提高。例如,如果crate 1.0需要Rust 1.20.0,那么所有crate 1.0.z的值也将需要Rust 1.20.0或更高版本。然而,对于crate 1.y,其中y > 0可能需要更高的最小Rust版本。

通常,此crate将保守地对待Rust支持的最小版本。

依赖项

~7–11MB
~195K SLoC