-
Notifications
You must be signed in to change notification settings - Fork 459
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
fix finding toolchains when invoked by msbuild #1201
Conversation
cc @ChrisDenton could you take a look at this PR please? |
Another note is that VSTEL_MSBuildProjectFullPath is also set by VS, so I suppose we could remove VisualStudioDir and just use VSTEL_MSBuildProjectFullPath instead |
This would be my preference. I think this should be kept as simple as possible. Though I wonder, is the |
Doesn't seem like it. I dumped the env here #1189 (comment) |
Fair enough. So I'd agree using |
8bb266c
to
3b58faf
Compare
Thank you russelltg ChrisDenton ! |
We're running The problem arises when we build for a different target than the host (e.g., using Is this expected behavior? |
Hmmm...not exactly sure, cc @ChrisDenton @russelltg any thoughts on this? |
Yes it was intentional. Many people using external build systems want the build system to be in full control of selecting the tools to use, etc. However, it's also clear that many other people were relying on us to automatically correct any tool mismatches. These two things are hard to reconcile, especially with MSBuild as it does not give us any information to go on. So we'd either need to not trust the environment (the previous behaviour) or else try to find another way to tell if there's a mismatch between targets. Off the top of my head I can think of a few things we could try:
I've not yet investigated or tested either of these options though. It would be good to have an issue rather than a closed PR. |
Thinking about it some more, part of the problem here is that EDIT: Ideally there would be a way to know if Cargo is building a build script. |
Yeah I think about that too, build-script are quite special in that it's always built for native.
Oh we already take the target, so
O think this makes sense |
I've created an issue for this here: #1308 |
As noted in #1189 (comment), when invoking msbuild from the commandline
VisualStudioDir
is not set.VSTEL_MSBuildProjectFullPath
does seem to be set reliably, even if it's undocumented....I'm open to alternative fixes here as well. It's possible that we should check that the value of it ends in
.vcxproj
as if it's a C# library or something it may not have the proper environment set (I'm rather unsure).