Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Fixed targets not imported during multitargeting #154

Merged
merged 1 commit into from
Jan 26, 2018

Conversation

ChristophLindemann
Copy link
Contributor

The buildMultiTargeting\NuGet.Build.Packaging.MultiTargeting.targets file was not imported into msbuild script during multi-target phase, due to the name not matching the package id.

Related to NuGet/Home#6277

Changed buildMultiTargeting\NuGet.Build.Packaging.MultiTargeting.targets
to
buildMultiTargeting\NuGet.Build.Packaging.targets,
removing the MultiTargeting part from the file name.

The issue is demonstrated and can be tested with the repo
https://github.com/ChristophLindemann/NuGet.Build.Packaging.MultiTargeting.Test

This is only a partial fix! The files are now correctly imported, but it fails with error NG0012: Duplicate package source files with distinct content detected. Duplicates are not allowed in the package. Please remove the conflict between these files... due to package content from referenced multitarget projects are imported multiple times.
I guess when resolving references, it should take into account the targetframework and only resolve those which are matching.

Maybe @kzu has some input on where/how to solve?

This problem can also be seen with the NuGet.Build.Packaging.MultiTargeting.Test repo after upgrading to a new version of NuGet.Build.Packaging with the fixed buildMultiTargeting stuff.

The "buildMultiTargeting\NuGet.Build.Packaging.MultiTargeting.targets"
was not imported into msbuild script during multi-target phase, due to
the name not matching the package id.
Changed
"buildMultiTargeting\NuGet.Build.Packaging.MultiTargeting.targets"
to
"buildMultiTargeting\NuGet.Build.Packaging.targets",
removing the MultiTargeting part from the file name.

Related to #6277
@kzu kzu merged commit 264e41a into NuGet:dev Jan 26, 2018
@kzu
Copy link
Contributor

kzu commented Jan 26, 2018

Thanks for your contribution!

@ChristophLindemann
Copy link
Contributor Author

@kzu, thank you! for making this package.

If you have any input on how to fix the duplicate problem, when referencing multi target projects, that would be greatly appreciated. Then I could try to fix that also.

Right now I don't have the full understanding of how these package files are resolved, where to filter (targets or task/c#) and how to filter so I select the files with the best matching target framework.

Example, when project.a (netstandard2.0; net471) references project.b (netstandard2.0;net451)
then when building proj.a (net471) it should probably reference proj.b (netstandard2.0) as the API surface matches better? Or should it reference proj.b (net451) because they both are framework version?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants