-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change the way to look for the default MSBuild instance #1349
Conversation
I don't think this is the right fix. I'm not sure the .NET Core SDK resolvers are installed when the .NET Core workload isn't installed. If that's true, this would cause OmniSharp to stop working for .NET Framework projects. |
Sorry, I'm failing to understand what do you mean with:
You are talking about the VS Installation? I would like some help to make sure that this works for both environments. Do you have any tests in mind? PS: I've been using a local build with this fix for 6 days now on VSCode and it works for every solution I've tested so far |
Also, sorry for taking so long to reply. GH is not the best at reminding you that something is pending. hehe 😅 |
Yes, I meant the VS installation. I suspect that |
I can write more tests, but this change is not exactly choosing .net core over full framework, the loop just tries to find a better (.net full + .net core) VS Installation. Sure it can be better, but to choose precisely the right framework I would need project info, which I don't know exactly how to get it. So the perfect solution would be:
|
Unfortunately, the perfect solution isn't exactly possible because the projects can't correctly be analyzed without using MSBuild to analyze the projects, and this code is all about finding the MSBuild that will be used. It's a chicken-and-the-egg situation. 😄
I don't think that's precisely accurate WRT to .net full + .net core. The loop will always prefer a VS installation with the .NET Core workload installed over .NET desktop workload. Note that these are different workloads in the VS installer and different installations of VS can have none, one, or both of them installed. I don't think this change will break things in practice (honestly, it'll probably make things better), but I don't think it's the right approach long term. I'd rather see us add configuration rather than more magic. |
Yeah, definitely is a chicken-and-the-egg situation hehehe but can we just analyze the egg from the outside in this situation? 😆 What I mean is that we can try to read all the
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/19tooOld" ToolsVersion="old"> = full framework Would that work? |
@johnnyasantoss: That'd be an estimate, but there would likely be edge cases where it didn't work. Also, we should be careful not to conflate .NET Core and .NET Framework with SDK-style projects and older-style projects. They aren't equivalent. After all, an SDK-style project can be made to target a .NET Framework TFM.
MSBuild doesn't have to do this at all, it just assumes that everything is installed to build any requested project. The SDK attribute is just a general MSBuild feature.
I wouldn't recommend any of that. It would almost certainly result hair-pulling, difficult to debug issues, not unlike the one you're trying to solve. 😄 Let's just go with your tweak for now. I really think the ideal experience is to provide good diagnostics when something goes wrong and add the proper configuration support to fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me modulo some comments. @DustinCampbell want to sign off?
@rchande are you going to review this again? or is it okay to be merged? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnnyasantoss Apart from my one comment this LGTM. Thanks for your contribution!
Note: Because @DustinCampbell is the expert on this area, I'm going to hold off merging for a couple of days to see if he cares to weigh in.
I pulled and built this locally and it appears to work. |
Now it is ready to be merged 😄 |
Hey, someone 📡 any updates on this PR? |
Should fix #1340, but I need to know if this is the best way to do it, and if it is I'll add tests.
Pls help :)