Skip to content
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

Some transformations on @(ReferencePath) result in mangled references #2165

Closed
rainersigwald opened this issue Jun 2, 2017 · 3 comments
Closed
Assignees
Labels
Milestone

Comments

@rainersigwald
Copy link
Member

Some builds fail with an error like

(CoreCompile target) ->
  CSC : error CS0006: Metadata file '%(FullPath)' could not be found

when building using VS 15.3 preview 2 builds (which are not yet public).

This ItemReferenceGroup sets a default value for the ReferenceAssembly metadata of ReferencePath items to %(FullPath). The engine evaluates that as a literal string, but it can be successfully read through by item transformations like FindReferenceAssembliesForReferences's @(ReferencePath->'%(ReferenceAssembly)'), because the evaluator recurses--it sees that literal, interprets it as a metadata reference, and reads the FullPath metadata.

However, not all transformations perform that recursion. An ITask implementation that uses return new TaskItem(oldItem), for example, evidently escapes the metadatum string, and when it is expanded it turns into a literal %(FullPath) instead of the value of the FullPath metadatum.

FindReferenceAssembliesForReferences then populates ReferencePathWithRefAssemblies with a list of items whose identity is %(FullPath), which isn't valid and confuses the compiler, producing the error above.

This is a regression introduced by e3a3d69 when implementing #1986.

@rainersigwald rainersigwald added this to the MSBuild 15.3 milestone Jun 2, 2017
@rainersigwald rainersigwald self-assigned this Jun 2, 2017
@rainersigwald
Copy link
Member Author

You can work around the bug by setting the property

<CompileUsingReferenceAssemblies>false</CompileUsingReferenceAssemblies>

which avoids transforming @(ReferencePath) using the recursive metadata expansion.

@rainersigwald
Copy link
Member Author

rainersigwald commented Jun 2, 2017

Thanks for reporting this @KirillOsenkov and @ToddGrun.

FYI @dsplaisted -- the task that hit this for them was StrongNamer. Filed dsplaisted/strongnamer#14 in the hopes that anyone who sees it will find it there.

KirillOsenkov added a commit to KirillOsenkov/monodevelop that referenced this issue Jun 2, 2017
MSBuild 15.3 will be briefly broken, see details here:
dotnet/msbuild#2165

It is not yet public and will be fixed soon, but we're already starting to hit the problem as we upgrade. To temporarily work around this until everybody upgrades the MSBuild that fixes the issue this is a simple workaround with no other side effects.
@rainersigwald
Copy link
Member Author

fyi @jcouv -- I'll also want to fix this in 15.3 p3.

KirillOsenkov added a commit to mono/monodevelop that referenced this issue Jun 2, 2017
MSBuild 15.3 will be briefly broken, see details here:
dotnet/msbuild#2165

It is not yet public and will be fixed soon, but we're already starting to hit the problem as we upgrade. To temporarily work around this until everybody upgrades the MSBuild that fixes the issue this is a simple workaround with no other side effects.
rainersigwald added a commit that referenced this issue Jun 5, 2017
Fixes #2165 by never putting a reference to metadata in the ReferenceAssembly field in the first place, so it's never there to get emplaced in a new item escaped and mangle things downstream.
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants