Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jetbrains/dotnet-project-model
.NET project model parser
https://github.com/jetbrains/dotnet-project-model
csproj-tooling dotnet
Last synced: 3 months ago
JSON representation
.NET project model parser
- Host: GitHub
- URL: https://github.com/jetbrains/dotnet-project-model
- Owner: JetBrains
- License: apache-2.0
- Archived: true
- Created: 2019-07-23T13:11:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-31T20:18:02.000Z (over 1 year ago)
- Last Synced: 2024-05-28T15:56:50.894Z (7 months ago)
- Topics: csproj-tooling, dotnet
- Language: Kotlin
- Homepage:
- Size: 152 KB
- Stars: 2
- Watchers: 23
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# .NET project model parser
Provides project model deserializer for .NET projects:
* csproj files
* project.json
* packages.config
* nuget.config
* project.asset.json## Example
```kt
// initialize utilitis services
val readerFactory = ReaderFactoryImpl()
val xmlDocumentService = XmlDocumentServiceImpl1()// initialize nuget.config deserializer and Discoverer
val nuGetConfigDeserializer = NuGetConfigDeserializer(xmlDocumentService)
val nuGetConfigDiscoverer = NuGetConfigDiscoverer(nuGetConfigDeserializer)// initialize project deserializers and Discoverer
val jsonProjectDeserializer = JsonProjectDeserializer(readerFactory, nuGetConfigDiscoverer)
val msBuildProjectDeserializer = MSBuildProjectDeserializer(xmlDocumentService, nuGetConfigDiscoverer)
val msBuildSolutionDeserializer = MSBuildSolutionDeserializer(readerFactory, msBuildProjectDeserializer)
val jsonAssetsProjectDeserializer = JsonAssetsProjectDeserializer(readerFactory, nuGetConfigDiscoverer)val deserializers = listOf(
jsonProjectDeserializer,
msBuildProjectDeserializer,
msBuildSolutionDeserializer,
jsonAssetsProjectDeserializer
)val discoverer = SolutionDiscoverImpl(deserializers)
//initialize stream factory
val projectRoot = File("/path/to/project")
val streamFactory = FileProjectStreamFactory(projectRoot)// deserialize project
val projectFiles = projectRoot.list()?.asSequence()?.map { Paths.get(it) } ?: emptySequence()
val solutions = discoverer.discover(streamFactory, projectFiles).toList()solutions.flatMap { it.projects }.forEach { println(it) }
```