Skip to content
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

MSBuildLocator.QueryVisualStudioInstances() returns zero results #124

Closed
MisinformedDNA opened this issue Feb 5, 2021 · 4 comments
Closed

Comments

@MisinformedDNA
Copy link

MisinformedDNA commented Feb 5, 2021

Similar to #17, MSBuildLocator.QueryVisualStudioInstances() returns zero results.

Project is targeting netcoreapp3.1 and I'm running within VS 16.8.4 (Enterprise).

Packages:

<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.8.0" />

NOTE: It works fine if I target net5.0.

@Forgind
Copy link
Member

Forgind commented Mar 11, 2021

See #92
Assuming you do not have earlier versions of VS, this is as intended. If you target an earlier runtime then grab an SDK/VS instance that expects a later runtime, it will try to use props, targets, etc. that don't exist and fail in weird and unclear ways. It would be like if I used a product that added method foo in version x, and I call foo but use an earlier version—it would have no idea what foo is.

Does that sound reasonable?

@MisinformedDNA
Copy link
Author

Sorry, I'm not following. MSBuildLocator targets net46;netcoreapp2.1, so why would net5.0 work and not netcoreapp3.1?

@Forgind
Copy link
Member

Forgind commented Mar 11, 2021

MSBuildLocator does support netcoreapp3.1, but if you want to target it, you need an MSBuild that was built with netcoreapp3.1 (or something older) in mind, or else it will try to use things netcoreapp3.1 doesn't know about. So if you have an older VS, SDK, etc., it can find those; it just won't find the 16.8 version because it's too new.

Are you able to target net5.0? If not, can you try downloading an older version of VS, say, 16.4, and checking that it finds it?

@MisinformedDNA
Copy link
Author

No I can target net5.0, I'm just not understanding. It's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants