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

The SDK 'Microsoft.NET.Sdk' specified could not be found. #24

Closed arivera12 closed 4 years ago

arivera12 commented 4 years ago

I am trying to add a project reference to a solution and this error message gets throw.

This is the code that throws the error.

sln.Result.Env.AddOrGet(new Project(XmlReader.Create(new StreamReader($@".\Solutions\{Namespace}\{Namespace}.Server\{Namespace}.Server.csproj"))));

I have net core sdk installed but couldn't figure out why this error occurs.

3F commented 4 years ago

Check this out for 2.x: https://github.com/3F/MvsSln/wiki/Advanced-Features#custom-msbuild-resolver

arivera12 commented 4 years ago

After trying to above solution its throws me an error when calling builder resolver telling me that the sdk have been already loaded. I added my own implementation for my needs. Thanks anyway.

3F commented 4 years ago

I added my own implementation for my needs.

I am a bit confused with your applied solution if we're talking about project files. Because it sounds you are doing something wrong:

Either you don't need msbuild resolver at all, or manipulations with xml-nodes + compatible evaluator engine are just a separate conversation which is more likely related to the planned v3.0 and so on.

arivera12 commented 4 years ago

Don't worry I just needed to add some items to a static project file.

3F commented 4 years ago

I see. XDocument-like solution could be really a good option for your case. The other cases with correct evaluated nodes should be processed through Sdk-resolvers (abstract layer in build.framework part). But means only modern project files and not .sln features where you can easily add something through related ProjectItem etc.

My hope for v3 that probably will fix the mentioned situation. Time will tell, follow the news.

On 22.03.2020 2:01, Anthony G. Rivera Cosme wrote:

Don't worry I just needed to add some items to a static project file.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/3F/MvsSln/issues/24#issuecomment-602116433, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYYT7LIGDTNT4QHA24GTE3RIVBK7ANCNFSM4LO6N5VQ.