-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
MSBuild SDKs version property is not expanded #5349
Comments
This is not supported as SDKs are parsed before any part of the project like properties, items, etc. I have an open issue to log an error if you try to put expandable characters in there. |
Even explicit imports? I was under impression these were evaluated simultaneously with the properties during the 1st pass. That's why you can put a
Well, logging is great, but isn't it better to just expand the properties (and log error only when evaluation has failed)? I use explicit imports, without this working I have to force |
Yes technically explicit imports would be possible to make work. But we also need to consider the pros and cons of making it work in one scenario ( |
@jeffkl but is this consistency worth more than feature-completeness? From my PoV, |
As an alternative you can put the version info in a global.json as described at https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2019#how-project-sdks-are-resolved |
@japj but that doesn't allow referencing MSBuild properties, does it? This is kind of the whole point of this issue. Imagine there is a lot of logic to compute version property. There is no way to use the computed value to resolve SDK. There is no benefit from moving from explicit versioned SDK imports to (explicit non-versioned SDK imports)+(global.json). |
The version of an imported SDK must match across the entire build session, so I'm not sure it makes sense to support property expansion there.
Can you expand on that, please? |
@rainersigwald SharpGen repo has a custom versioning logic. If repo is built on local PC (not via Azure DevOps CI), version string is
SdkTests must know the just-built package version to restore. This is only possible if these properties become expandable. I have implemented a workaround for now (change all non-release builds to use 42.42.42 as a version), but that still makes it impossible to run I have already fixed this issue in my local MSBuild branch and I've refactored By the way, one can inject properties visible in |
This is what I wanted to do. See: #1518 (comment) I personally welcome this change but if we're allowing versions then we can move the |
Fix #5349. Unlike #5378 (which didn't fix #5349 but introduced a lot of refactorings around SdkReference), this doesn't do anything but implement the fix for #5349. #5378 is absolutely separate from this PR and the feature request #5349 in question. I emphasize the simplicity of adding this feature, and the flexibility it provides.
Steps to reproduce
Directory.Build.props file:
Expected behavior
SharpGenTools.Sdk/2.0.0-local
is resolved and imported.Actual behavior
SharpGenTools.Sdk/$(LocalPackageVersion)
fails to be resolved by NuGet resolver.Log:
Environment data
Source
ProjectImportElement.ParsedSdkReference
contains unexpanded properties from XML element, butEvaluator.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned
doesn't expand them before passing to SDK resolvers.Cross-referencing my SharpGen branch.
The text was updated successfully, but these errors were encountered: