{"id":17173254,"url":"https://github.com/stevenaw/vs-utils","last_synced_at":"2026-05-09T14:41:39.280Z","repository":{"id":40753705,"uuid":"98757429","full_name":"stevenaw/vs-utils","owner":"stevenaw","description":"Node-based utilities for working with Visual Studio projects/solutions","archived":false,"fork":false,"pushed_at":"2022-06-24T18:33:57.000Z","size":144,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-18T15:55:23.444Z","etag":null,"topics":["node","npm","parse","parser","visual-studio"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stevenaw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-29T20:33:27.000Z","updated_at":"2022-06-24T18:33:20.000Z","dependencies_parsed_at":"2022-07-29T08:19:48.716Z","dependency_job_id":null,"html_url":"https://github.com/stevenaw/vs-utils","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenaw%2Fvs-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenaw%2Fvs-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenaw%2Fvs-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenaw%2Fvs-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevenaw","download_url":"https://codeload.github.com/stevenaw/vs-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245347114,"owners_count":20600434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node","npm","parse","parser","visual-studio"],"created_at":"2024-10-14T23:50:26.529Z","updated_at":"2026-05-09T14:41:39.219Z","avatar_url":"https://github.com/stevenaw.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vs-utils\n\n[![Azure Pipelines Build Status](https://dev.azure.com/sweerdenburg/vs-utils/_apis/build/status/stevenaw.vs-utils?branchName=master)](https://dev.azure.com/sweerdenburg/vs-utils/_build/latest?definitionId=3\u0026branchName=master)\n\nNode-based read-only object model for parsing and reading Visual Studio projects/solutions.\n\n## Parsing Functions\n### parseSolution\n```js\nparseSolution(file, opts);\n```\n\n#### Arguments\n- **file** - Can be a path, file contents, or buffer\n- **opts** - An options object (optional). For details see [`Parsing Options`](#parsing-options)\n\n#### Return value\nA `Promise` which resolves to a [`Solution`](#solution) object\n\n\n### parseSolutionSync\n```js\nparseSolutionSync(file, opts);\n```\n\n#### Arguments\n- **file** - Can be a path, file contents, or buffer\n- **opts** - An options object (optional). For details see [`Parsing Options`](#parsing-options)\n\n#### Return value\nA [`Solution`](#solution) object\n\n\n### parseProject\n```js\nparseProject(file, opts);\n```\n\n#### Arguments\n- **file** - Can be a path, file contents, or buffer\n- **opts** - An options object (optional). For details see [`Parsing Options`](#parsing-options)\n\n#### Return value\nA `Promise` which resolves to a [`Project`](#project) object\n\n\n### parseProjectSync\n```js\nparseProjectSync(file, opts);\n```\n\n#### Arguments\n- **file** - Can be a path, file contents, or buffer\n- **opts** - An options object (optional). For details see [`Parsing Options`](#parsing-options)\n\n#### Return value\nA [`Project`](#project) object\n\n## Parsing Options\nAn `options` object can be passed to a parsing function to customize its behaviour.\n\n#### deepParse\n`deepParse` - Specifying `true` will also read and parse all dependencies. Defaults to `false`.\n\nExample: A solution is dependent on its projects, while a project is dependent on its packages.\n\n#### dirRoot\n`dirRoot` - The root directory under which the solution or project lives. Defaults to `undefined`.\n\nRequired when doing a deep parse of a solution or project from file contents or a buffer.\n\n\n## Examples\nFor a full list of samples and demos, see the [samples](./samples) folder.\nAlternately, clone the repository and run `npm run demo`.\n\n### Parse solution from path and enumerate projects\n```js\nconst vsUtils = require('vs-utils');\n\nconst solution = await vsUtils.parseSolution('HelloWorld.sln');\n\nsolution.projects.forEach(project =\u003e {\n  const projectName = project.name;\n  console.log(`Project: ${project.name}\\r\\n`);\n});\n```\n\n### Parse solution from file contents and find test projects\n```js\nconst vsUtils = require('vs-utils');\nconst fs = require('fs');\n\nconst contents = await fs.readFile('HelloWorld.sln', { encoding: 'utf-8' });\nconst solution = await vsUtils.parseSolution(contents);\nconst testProjects = solution.projects.filter(proj =\u003e proj.determinePackageVersion('NUnit'));\n```\n\n### Parse  solution from buffer and find packages with multiple versions\n```js\nconst vsUtils = require('vs-utils');\nconst fs = require('fs');\n\nconst buffer = await fs.readFile('HelloWorld.sln');\nconst solution = await vsUtils.parseSolution(buffer);\n\nconst packageMap = solution.getAllPackageVersions();\nconst filteredPackages = Array.from(packageMap.entries()).filter(value =\u003e value[1].length \u003e 1);\nconst packages = new Map(filteredPackages);\n\nconsole.log('Packages with multiple versions in solution');\nconsole.log(packages);\n```\n\n## Object Model\n\n### Solution\n#### Properties\n\n- **fileFormatVersion** - `string` - The version of the Visual Studio file format\n- **visualStudioVersion** - `string` - The version of Visual Studio to use the solution\n- **minimumVisualStudioVersion** - `string` - The minimum version of Visual Studio to use the solution\n- **projects** - `array` - An array of [`Project`](#project) instances\n\n#### Functions\n\n##### data()\nReturns the underlying parsed project info\n##### determinePackageVersions(packageName)\nReturns an array of [`Version`](#version) instances for the given package name\n##### determineAssemblyVersions(assemblyName)\nReturns an array of [`Version`](#version) instances for the given assembly name\n##### getProject(projectName)\nReturns a [`Project`](#project) instance by name (or undefined if not found)\n##### getAllPackageVersions()\nReturns a `Map` of package names mapped to an array of [`Version`](#version) instances\n##### getAllAssemblyVersions()\nReturns a `Map` of assembly names mapped to an array of [`Version`](#version) instances\n\n### Project\n#### Properties\n\n- **id** - `string` - The ID of the project\n- **name** - `string` - The name of the project\n- **relativePath** - `string` - The path of the project, relative to the solution file\n- **projectTypeId** - `string` - The Type ID of the project\n- **codeFiles** - `array` - An array of strings of code files in the project\n- **packages** - `array` - An array of packages in the project\n- **references** - `array` - An array of references in the project\n\n#### Functions\n\n##### data()\nReturns the underlying parsed project info\n##### determinePackageVersion(packageName)\nReturns the [`Version`](#version) instance of the package in the project\n##### determineAssemblyVersion(assemblyName)\nReturns the [`Version`](#version) instance of the assembly in the project\n\n### Version\n#### Properties\n\n- **major** - `string` - The major version number\n- **minor** - `string` - The minor version number\n- **patch** - `string` - The patch version number\n- **version** - `string` - The full version string\n- **originalString** - `string` - The original version string","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenaw%2Fvs-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevenaw%2Fvs-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenaw%2Fvs-utils/lists"}