3F / MvsSln

🧩 Customizable VisualStudio .sln parser with project support (.vcxproj, .csproj., …). Pluggable lightweight r/w handlers at runtime, and more …
MIT License
135 stars 27 forks source link

Is there a way to identify a nuget reference? #27

Closed tecnocrata closed 4 years ago

tecnocrata commented 4 years ago

Hello there, I'm using this fantastic library and have a question, I'm parsing a csproj file. with something like this:

foreach (IXProject xp in sln.Result.Env.Projects)
                    {
...

and I want to identify which references are nuget or not, Is there a way to do that? I'm using this

xp.GetItems("Reference")

but that instruction returns all references, including nuget ones but not sure how to identify in them on that list

Any help would be appreciated

3F commented 4 years ago

Depends on what type of NuGet references you need.

As I voiced here https://github.com/3F/DllExport/issues/152#issuecomment-629402920 At least:

I know, this part is not so good covered for most convenient use today. Any PR welcomed! But I think it will be reviewed together with planned 3.0 (within IeXod integration) or a bit later.

Today, however, you can try GetItems("PackageReference") including legacy types.

For packages.config you can try to adapt my implementation here https://github.com/3F/DllExport/blob/master/Wizard/LegacyPackagesFile.cs But I think we should consider a common implementation like LegacyPackagesFile as part of MvsSln and/or IeXod.

Let me know if you still have some problems or questions.

tecnocrata commented 4 years ago

thank you 3F

3F commented 4 years ago

@tecnocrata You're welcome. I'm glad to hear that was helpful!

Some related improvements will be considered later. Just follow the news.