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

"Sequence contains no matching element" when using a bad TF #13772

Open
dfederm opened this issue Sep 6, 2024 · 0 comments
Open

"Sequence contains no matching element" when using a bad TF #13772

dfederm opened this issue Sep 6, 2024 · 0 comments
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:Restore Type:Bug

Comments

@dfederm
Copy link

dfederm commented Sep 6, 2024

NuGet Product Used

MSBuild.exe

Product Version

MSBuild version 17.9.8+b34f75857 for .NET Framework

Worked before?

No

Impact

It's more difficult to complete my work

Repro Steps & Context

Error:

...\Current\bin\NuGet.targets(169,5): error : Sequence contains no matching element [<repo>\dirs.proj]

This happened when accidentally using:

    <TargetFramework>net8.0;net472</TargetFramework>

This is clearly a user error, but the error message could be more helpful. At the very least it should point to the problematic project instead of the root project for the restore.

I can only get this specific error to repro under certain conditions which I'm not able to fully understand. eg it manifests this way when restoring from the root. When restoring the project directly I helpfully get:

NETSDK1046: The TargetFramework value 'net8.0;net472' is not valid. To multi-target, use the 'TargetFrameworks' property instead.

I would guess it maybe only manifests when a projects depends on the problematic project? Not super sure though.

Attaching a debugger shows that the exception is thrown here:
image

And the stack in case it's helpful:
image

I can provide more specific details (specific internal repo and commit) offline if desired.

Verbose Logs

No response

@kartheekp-ms kartheekp-ms added Functionality:Restore Area:ErrorHandling warnings and errors/log messages & related error codes. and removed Triage:Untriaged labels Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:Restore Type:Bug
Projects
None yet
Development

No branches or pull requests

2 participants