-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
In MSBuild xplat pass through path to msbuild.exe host as a property #720
Comments
Can you please detail more? Are you suggesting that each ToolTask has a way to access the host that MSBuild is run under? I guess there's a couple of ways to do it:
|
The motivating scenario here is that the Csc tooltask needs to explicitly have the host overridden by the cli when executing under With that in mind, I think that your option 2 seems most appropriate. ToolTasks would automatically be run under the host msbuild is being run under with the override gesture being reserved for cases where that isn't appropriate or some customization needs to happen. |
At some point, @eerhardt also mentioned that Roslyn might be recommending people wrap execution in a batch script like All that said, I still think we should at least expose the host as a property to tasks. I'm not convinced yet that there is a good way to determine whether or not the app should run under the same host though... |
This is no longer necessary for the CLI in Visual Studio 15 RC. The Roslyn team recommends to ship "wrapper" From the perspective of the CLI, this issue can be closed. (I don't have permissions to close issues in this repo.) |
Is that the general "how you should run a managed tool in a build" advice, @eerhardt? |
I'm not sure if that is the general advice. But this is the advice for invoking The generalized approach being employed by the Roslyn team here is for a ToolTask to allow the caller to pass in the path and name to the executable to invoke. This seems like a fine approach in general to me. The caller can and will have more context to where the tool is in their scenario. And if the ToolTask is unable to figure it out, at least it gives the caller an "escape hatch". |
I agree on using batch files. I happen to have a compiler to only runs on .NET/Mono which cannot be run on .NET Core (even if it supports it as a target) and the batch file method would allow me to use it with the new cross-plat MSBuild. |
To be clear @borgdylan, it's a hard requirement that users be able to execute a script or native binary in a This issue is about making it easier to run .NET Core applications. Right now that requires either modifying the project file or using a wrapper script as the tool (and that wrapper script has no way to determine "the CLI host that is currently running MSBuild" which is probably the most common scenario). |
So should we consider this solved by way of using batch files? Or should we expose a property that indicates the path to the CLR host? |
The community has spoken and we're going to leave it up to task authors for now. We'll gladly revisit this if enough people feel like they need support for it. |
Re; aspnet/KestrelHttpServer#1748 Had to propagate dotnet location to run Csc.exe from a task by forcing it to be on the PATH. And had to do that in two environments - regular run and in a docker. Took some time to figure why one fails and not another (was using different PATH env). It could be more convenient to use a property. |
This will solve the issue of needing to set an environment variable in the cli when invoking msbuild.exe so the same host can be used to execute csc.exe.
@cdmihai @rainersigwald
The text was updated successfully, but these errors were encountered: