-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Question about msbuild dependencies #2310
Comments
@rainersigwald @DustinCampbell any ideas? |
You should not add references to any MSBuild packages when using MSBuildWorkspace. In fact, if there are any Here's a pull request where I showed an MSBuildWorkspace consumer how to modify their project to use MSBuildWorkspace successfully: FizzerWL/ErrorRepro#1. In addition, we are releasing a new version of MSBuildWorkspace soon and we're including some documentation. Here is a gist with an early look at the docs that show how to be successful with MSBuildWorkspace: https://gist.github.com/DustinCampbell/32cd69d04ea1c08a16ae5c4cd21dd3a3. What is R4MVC? |
Thanks @DustinCampbell it works! R4MVC is a tool to generate aspnet core helper methods to generate links (like t4mvc was for aspnet) and avoid the messy string parameters. Thanks! |
You could do it in a self-contained way, but you would need to ship MSBuild and all of the tasks/targets needed to process any project that you want to throw at it. If you only care about .NET Core projects, this is a smaller set, but it's up to you to deploy them. At a minimum, you would need the following packages for .NET Core projects:
Then, you would also deploy the SDK resolvers which are used by MSBuild to locate the .NET Core SDK appropriate for a particular project. |
Sorry, I also forgot that you would likely need to deploy the NuGet.Build.Tasks since the latest MSBuild common targets depend on that. Essentially, this is just not a simple thing to do. And the steps I provided only work for SDK-style projects. Supporting .NET Framework projects is another problem entirely from a deployment perspective. Even worse, your application will need to be updated to support any new MSBuild features, which can put you in a bad spot. |
Thanks for the explanation ! it's very helpfull ! |
Everything I outlined above is how you do that today. |
Awesome, this looks like it should let us move forward. Thanks! Are there any plans to make |
Just one more thing, how do we do this ? I tried without luck to find any doc related
|
@artiomchi: Potentially. There is some investigation being done on that. |
@valeriob: are firmly in undocumented and unsupported territory if you're deploying MSBuild yourself. 😄 However, we do exactly this same thing successfully in OmniSharp: https://github.com/OmniSharp/omnisharp-roslyn. The SDK resolvers are available from the nightly dotnet-core feed on MyGet (https://dotnet.myget.org/gallery/dotnet-core). The following packages are available:
Note that these are native packages that our OS dependent. In addition, they have to be laid out in a specific way on the disk. You should be able to gleen that from how OmniSharp does it if you want to go down this route. |
@valeriob You don't necessarily need the full VS install either - we just need a version of MSBuild installed on the system. From what I understand, you could just install the VS Build tools, which is a MUCH lighter install. It will install the compilers on the system without the whole IDE, and should still be picked up by the |
@DustinCampbell Thanks again by the way - I just tested your approach in R4MVC and it worked perfectly. I have no idea how I haven't noticed this package (and haven't read about it before). It's exactly what I've been looking for. Regarding the workspace support with .NET Standard - is there a GitHub issue or some other thread that I can subscribe to to follow the progress on this? |
There are many issues, though this one looks most relevant: dotnet/roslyn#17968. |
Yep thanks, |
@valeriob That's tracked by microsoft/MSBuildLocator#30. An attempt was started, but it's turning out to be surprisingly complicated and hasn't been completed. |
Thanks ! /subscribed 😄 |
Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label. |
This issue will now be closed since it has been labeled 'stale' without activity for 30 days. |
Hi,
![image](https://user-images.githubusercontent.com/1522516/41032287-2603fa96-6983-11e8-99ce-8ddfa15493e1.png)
in R4MVC we use MSBuildWorkspace to navigate the project and generate code.
To make it work we need to add references to msbuild nuget packages :
Microsoft.Build and Microsoft.Build.Tasks.Core.
If we do not add those references a simple main does not work :
Problem is that every time the sdk ships a new version we are forced to update that reference because it's not compatible in some way. See #T4MVC/R4MVC#99
Is there a way to avoid this issue ?
The text was updated successfully, but these errors were encountered: