Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

2.0: MSBuildSdkResolver: resolve symlink for 'dotnet' binary - #7137

Merged
nguerrera merged 1 commit into
dotnet:release/2.0.0from
akoeplinger:2.0-dotnet-symlink-fix
Jul 13, 2017
Merged

nguerrera merged 1 commit into
dotnet:release/2.0.0from
akoeplinger:2.0-dotnet-symlink-fix

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Jul 12, 2017 •

Copy link
Copy Markdown
Member

Backport of #7126 to release/2.0.0.

ASK MODE template:

Customer scenario

msbuild shipped with Mono 5.2 won't pick up msbuild sdks from .NET Core on Linux before this fix since the sdkresolver doesn't correctly find the .NET Core installation directory.

Bugs this fixes

#7125

Workarounds, if any

Set DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR env var to /usr/share/dotnet

Risk

Zero, since you're not using the netstandard binary of the sdkresolver in Windows/msbuild but the NET46 version.

Performance impact

Low

Root cause analysis

We removed "run as user" during install process. However, native installer other than Windows are using the old prime cache command which will create templatecache folder as super user and caused the permission denied

How was the bug found?

Xamarin testing

On Linux the dotnet installed by the dotnet packages is a
symlink (/usr/bin/dotnet -> ../share/dotnet/dotnet).

We need to resolve the symlink so we're passing the path to
the actual .NET Core installation to libhostfxr.

Fixes https://github.com/dotnet/cli/issues/7125
@dnfclas

dnfclas commented Jul 12, 2017

Copy link
Copy Markdown

@akoeplinger,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@livarcocc

Copy link
Copy Markdown

@akoeplinger if you need this considered for 2.0, can you please fill out the ASK MODE template like here: #7129?

@akoeplinger

Copy link
Copy Markdown
Member Author

@livarcocc updated. My main motivation for this is getting a build of the assembly from the myget packages (but we can just build it ourselves as well without too much work).

Should be easy given that it has no impact on the binaries you're shipping on Windows/msbuild :)

@livarcocc

Copy link
Copy Markdown

@srivatsn for approval.

@livarcocc livarcocc added this to the 2.0.0 milestone Jul 13, 2017
@livarcocc

Copy link
Copy Markdown

cc @nguerrera

@nguerrera

Copy link
Copy Markdown
Contributor

@akoeplinger Can you point me to the resolver package you're using? AFAIK, we don't actually package up the portable version and push it anywhere. Maybe I missed some build magic that did this automagically, but I'm not finding any such package in our myget feed. It's been on the backlog to get done as @DustinCampbell needs it for VS code too (or perhaps it would flow there via mono msbuild automaticaIly?) I'll be happily surprised if it's already done, but I'm missing how that's the case.

@nguerrera
nguerrera merged commit b38b69b into dotnet:release/2.0.0 Jul 13, 2017
@DustinCampbell

Copy link
Copy Markdown
Member

I don't think it's there as part of the Mono MSBuild that we provide in C# for VS Code.

@akoeplinger

Copy link
Copy Markdown
Member Author

@nguerrera I talked to our msbuild dev about it and looks like I misunderstood a bit: we took the libhostfxr.dylib from a myget package but actually built the netstandard version of Microsoft.DotNet.MSBuildSdkResolver.dll ourselves :)

@akoeplinger
akoeplinger deleted the 2.0-dotnet-symlink-fix branch July 13, 2017 17:57
@nguerrera

Copy link
Copy Markdown
Contributor

@akoeplinger @DustinCampbell And the mono msbuild that has this custom build is different from the one that C# VS Code uses?

@DustinCampbell

Copy link
Copy Markdown
Member

Yes. We don't acquire MSBuild from Mono. On OSX/Linux, we build it ourselves. Besides, this wouldn't help C# for VS Code on Windows.

@nguerrera

Copy link
Copy Markdown
Contributor

Got it. OK, we should just pack the project and push it. It shouldn't be too hard.

@nguerrera

Copy link
Copy Markdown
Contributor

#7151

@DustinCampbell

Copy link
Copy Markdown
Member

BTW, this is a very nice fix. I may pull it into OmniSharp for resolving symlinks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants