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

Replacement for Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace? #17974

Closed
davkean opened this issue Mar 19, 2017 · 30 comments
Closed

Replacement for Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace? #17974

davkean opened this issue Mar 19, 2017 · 30 comments
Assignees
Milestone

Comments

@davkean
Copy link
Member

davkean commented Mar 19, 2017

From @MarkMichaelis on January 20, 2017 23:38

In migrating from VS2015 to VS2017, is Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace the intended replacement for Microsoft.DotNet.ProjectModel.Workspaces.ProjectJsonWorkspace? Or is there some other implementation of Microsoft.CodeAnalysis.Workspace that we should be using?

/cc @GrantErickson, @morrisjoe, @breaman, @ascott18

Copied from original issue: dotnet/project-system#1285

@davkean
Copy link
Member Author

davkean commented Mar 19, 2017

From @srivatsn on January 30, 2017 17:28

Yes MSBuildWorkspace should work for these projects. Now I know @mattwar was looking into MSBuildWorkspace being broken due to MSBuild moving elsewhere. Matt, does MSBuildWorkspace work with MSBuild 15 (which is needed for it to understand .NET core projects).

@davkean
Copy link
Member Author

davkean commented Mar 19, 2017

From @mattwar on January 30, 2017 19:0

Msbuild should work in RC3. Though you'll need to upgrade the app's redirects to include the newest msbuild's redirects found in msbuild.exe.config.

@davkean
Copy link
Member Author

davkean commented Mar 19, 2017

From @josephwoodward on February 23, 2017 0:27

Does MSBuildWorkspace support the .NET Standard? IE, can it be used for loading .NET Core projects on Mac and Linux?

@davkean
Copy link
Member Author

davkean commented Mar 19, 2017

From @mattwar on February 23, 2017 0:30

MSBuildWorkspace only supports desktop clr currently.

@davkean
Copy link
Member Author

davkean commented Mar 19, 2017

From @josephwoodward on February 23, 2017 1:21

Ok, thank you for the prompt reply!

@davkean
Copy link
Member Author

davkean commented Mar 19, 2017

From @josephwoodward on February 23, 2017 2:51

@mattwar Do you have any suggestions as where to look or what to do for anyone that wants to load the new MsBuild .csproj proj format on Mac and Linux?

@josephwoodward
Copy link

Would love to see .NET Standard support for MSBuildWorkspace so it will be usable on a Mac or Linux.

@per-samuelsson
Copy link

@josephwoodward

Regarding

@mattwar Do you have any suggestions as where to look or what to do for anyone that wants to load the new MsBuild .csproj proj format on Mac and Linux?

you might find some info in #14206, and more explicitly, by starting from this #14206 (comment). In the end, it turned out that proposal was not really x-plat either though, but could be worth looking up again.

@Pilchie Pilchie added this to the 15.3 milestone Mar 20, 2017
@Pilchie Pilchie self-assigned this Mar 20, 2017
@Pilchie
Copy link
Member

Pilchie commented Mar 20, 2017

I think the ideal would be to make MSBuildWorkspace just work in 15.3 - I'm going to take a look and see if this is feasible.

@Pilchie Pilchie assigned DustinCampbell and unassigned Pilchie Mar 20, 2017
@per-samuelsson
Copy link

I think the ideal would be to make MSBuildWorkspace just work in 15.3

And what about x-plat story? 15.x and x-plat is two separate concerns, yes?

@stuartleeks
Copy link

Any update on the x-plat story for loading csproj workspaces?

@josephwoodward
Copy link

Any update on the x-plat story for loading csproj workspaces?

Really interested to know this too! Is it still on the road map?

@ltcmelo
Copy link

ltcmelo commented Apr 10, 2018

Me too, could anyone please shared an update on this issue?

In addition, I'd like to ask how people have "replaced" the absence of MSBuildWorkspace so far - I've tried https://github.com/daveaglick/Buildalyzer, but I can't use it due to package incompatibilities (downgrade with Microsoft.Win32.Primitives and similar) - see my UPDATE in the next post. Any comments is appreciated.

@daveaglick
Copy link
Contributor

@ltcmelo Feel free to open an issue in Buildalyzer if the package incompatibilities are something that could be potentially resolved upstream.

@ltcmelo
Copy link

ltcmelo commented Apr 10, 2018

@davkean Thanks for the hint. I'll give it a try compiling it locally and, if I don't see a reason for the incompatibility, I'll fill a report.

UPDATE: I got it working with the 15.7.0 preview.

@IanKemp
Copy link
Contributor

IanKemp commented Jun 1, 2018

Any progress on this? Seems it didn't make it into 15.7 which makes me a sad panda 😢

If cross-platform is what's holding this back, I'd strongly suggest ignoring non-Windows platforms for now just to get something shipped to plug this glaring absence - since most users of this package are going to be on Windows, the 80/20 rule applies.

@IanKemp
Copy link
Contributor

IanKemp commented Jun 1, 2018

See also: #17968

@DustinCampbell
Copy link
Member

@IanKemp: The new MSBuildWorkspace is in the Roslyn 2.9.0 which are not yet on NuGet.

@stuartleeks
Copy link

@DustinCampbell - is 2.9.0 available via a preview feed to give it a try? :-)

@DustinCampbell
Copy link
Member

Yes. It has been for awhile now. However, if I recall correctly, you're looking for a cross-plat version, correct? Currently, it only supports Windows.

@stuartleeks
Copy link

You are correct (I'm looking for xplat). Was quickly scanning the notification and got my hopes up!

@IanKemp
Copy link
Contributor

IanKemp commented Jun 4, 2018

For anyone looking for the preview bits including MSBuildWorkspace: add https://dotnet.myget.org/F/roslyn/api/v3/index.json as a package source in VS, then open the Package Manager for your project, ensure "Include prerelease" is ticked and that your "Package source" is set to "All", and then install Microsoft.CodeAnalysis.Workspaces.Common (3.0.0-dev as of the time of this writing).

Note that, because the MSBuild bits are still not available in .NET Standard/Core, your project has to target .NET Framework 4.6 or higher.

@josephwoodward
Copy link

Bah, saw this had been updated and got all excited thinking cross-platform support was finally added :(

@tomakita
Copy link

tomakita commented Oct 3, 2018

It's not clear from reading through this issue (forgive me if this is mentioned somewhere and I missed it) -- is .NET Standard support for MSBuildWorkspace something that's planned?

@vytautas-pranskunas-
Copy link

Any updates on this?

@ErikSchierboom
Copy link

Any plans to enable cross-platform support?

@bklebe
Copy link

bklebe commented May 4, 2020

Definitely still interested in cross-platform support for this. I'm writing a static analysis and code exploration tool and not having this API on macOS and Linux is pretty unfortunate. Willing to help implement as well.

@jmarolf
Copy link
Contributor

jmarolf commented May 6, 2020

It is my understanding that this should "just work" now if you use MSBuildLocator with a .NET Core SDK installed

@jmarolf jmarolf closed this as completed May 6, 2020
@bklebe
Copy link

bklebe commented May 6, 2020

Oh perfect! Thanks for the clarification.

@EamonNerbonne
Copy link

Thanks for the link to the locator, solved my issues too!

In case sometime finds this after some googling, to use MSBuildWorkspace on .net core you can follow these instructions: https://docs.microsoft.com/en-us/visualstudio/msbuild/updating-an-existing-application - essentially adding a reference to Microsoft.Build.Locator; adding ExcludeAssets="runtime" to other Microsoft.Build.??? <PackageReferences>, and calling MSBuildLocator.RegisterDefaults(); at the start of your program.

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

No branches or pull requests