Skip to content

Commit 279cdad

Browse files
authored
Pack is aliased framework aware and supports deduplication to allowed aliased projects to be packed. (#7227)
1 parent b5ca9db commit 279cdad

25 files changed

Lines changed: 641 additions & 66 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
- Use the following coding guidelines: https://github.com/NuGet/NuGet.Client/blob/dev/docs/coding-guidelines.md
1111
- Never use reflection.
12+
- When using value tuples, never use `var` (e.g., `var result = Method()`), but always use decomposed names (e.g., `(var name, var value) = Method()`).
1213

1314
## Project-Specific Rules
1415

src/NuGet.Core/NuGet.Build.Tasks.Pack/GlobalSuppressions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@
8787
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.BuildLicenseMetadata(NuGet.Build.Tasks.Pack.IPackTaskRequest{NuGet.Commands.IMSBuildItem})~NuGet.Packaging.LicenseMetadata")]
8888
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.GetAssetsFile(NuGet.Build.Tasks.Pack.IPackTaskRequest{NuGet.Commands.IMSBuildItem})~NuGet.ProjectModel.LockFile")]
8989
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.InitCurrentDirectoryAndFileName(NuGet.Build.Tasks.Pack.IPackTaskRequest{NuGet.Commands.IMSBuildItem},NuGet.Commands.PackArgs)")]
90-
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.InitLibFiles(NuGet.Commands.IMSBuildItem[],System.Collections.Generic.IDictionary{System.String,System.String})~System.Collections.Generic.IEnumerable{NuGet.Commands.OutputLibFile}")]
9190
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.InitNuspecOutputPath(NuGet.Build.Tasks.Pack.IPackTaskRequest{NuGet.Commands.IMSBuildItem},NuGet.Commands.PackArgs)")]
9291
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.InitOutputExtensions(System.Collections.Generic.IEnumerable{System.String})~System.Collections.Generic.HashSet{System.String}")]
93-
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.ParseFrameworks(NuGet.Build.Tasks.Pack.IPackTaskRequest{NuGet.Commands.IMSBuildItem},System.Collections.Generic.IDictionary{System.String,System.String})~System.Collections.Generic.ISet{NuGet.Frameworks.NuGetFramework}")]
9492
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.ParsePackageTypes(NuGet.Build.Tasks.Pack.IPackTaskRequest{NuGet.Commands.IMSBuildItem})~System.Collections.Generic.ICollection{NuGet.Packaging.Core.PackageType}")]
95-
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.PopulateFrameworkAssemblyReferences(NuGet.Packaging.PackageBuilder,NuGet.Build.Tasks.Pack.IPackTaskRequest{NuGet.Commands.IMSBuildItem})")]
96-
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Build.Tasks.Pack.PackTaskLogic.PopulateFrameworkReferences(NuGet.Packaging.PackageBuilder,NuGet.ProjectModel.LockFile)")]

src/NuGet.Core/NuGet.Build.Tasks.Pack/PackTaskLogic.cs

Lines changed: 135 additions & 54 deletions
Large diffs are not rendered by default.

src/NuGet.Core/NuGet.Build.Tasks.Pack/Strings.Designer.cs

Lines changed: 38 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/NuGet.Core/NuGet.Build.Tasks.Pack/Strings.resx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -117,6 +117,16 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120+
<data name="AmbigiousFrameworkReferences" xml:space="preserve">
121+
<value>Ambiguous framework references. The following target frameworks are both declaring framework references for packing: {0}</value>
122+
<comment>0 - List of TargetFramework with framework refs</comment>
123+
</data>
124+
<data name="AmbigiousPackageAssemblies" xml:space="preserve">
125+
<value>Ambiguous packaging content. The above frameworks have the same target path for {0}.</value>
126+
</data>
127+
<data name="AmbigiousPackageDependencies" xml:space="preserve">
128+
<value>Ambiguous package dependencies. The following target frameworks are both declaring package dependencies for packing: {0}</value>
129+
</data>
120130
<data name="AssetsFileDoesNotHaveValidPackageSpec" xml:space="preserve">
121131
<value>The assets file found does not contain a valid package spec. Try restoring the project again. The location of the assets file is {0}.</value>
122132
<comment>{0} is the path to the assets file.</comment>
@@ -125,6 +135,11 @@
125135
<value>The assets file produced by restore does not exist. Try restoring the project again. The expected location of the assets file is {0}.</value>
126136
<comment>{0} is the path to the assets file.</comment>
127137
</data>
138+
<data name="DuplicateFrameworks" xml:space="preserve">
139+
<value>This project is using aliased frameworks, the following TargetFramework properties map to the same effective frameworks '{0}' and pack is unable to disambiguate and create a single package. {1}</value>
140+
<comment>0 - details about which framework
141+
1 - Additional details</comment>
142+
</data>
128143
<data name="Error_FileNotFound" xml:space="preserve">
129144
<value>The file '{0}' to be packed was not found on disk.</value>
130145
<comment>{0} is the file being packed.</comment>
@@ -172,4 +187,4 @@
172187
<value>The PackageLicenseUrl is being deprecated and cannot be used in conjunction with the PackageLicenseFile or PackageLicenseExpression.</value>
173188
<comment>Please don't localize PackageLicenseUrl, PackageLicenseFile and PackageLicenseExpression.</comment>
174189
</data>
175-
</root>
190+
</root>

src/NuGet.Core/NuGet.Build.Tasks.Pack/xlf/Strings.cs.xlf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="cs" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AmbigiousFrameworkReferences">
6+
<source>Ambiguous framework references. The following target frameworks are both declaring framework references for packing: {0}</source>
7+
<target state="new">Ambiguous framework references. The following target frameworks are both declaring framework references for packing: {0}</target>
8+
<note>0 - List of TargetFramework with framework refs</note>
9+
</trans-unit>
10+
<trans-unit id="AmbigiousPackageAssemblies">
11+
<source>Ambiguous packaging content. The above frameworks have the same target path for {0}.</source>
12+
<target state="new">Ambiguous packaging content. The above frameworks have the same target path for {0}.</target>
13+
<note />
14+
</trans-unit>
15+
<trans-unit id="AmbigiousPackageDependencies">
16+
<source>Ambiguous package dependencies. The following target frameworks are both declaring package dependencies for packing: {0}</source>
17+
<target state="new">Ambiguous package dependencies. The following target frameworks are both declaring package dependencies for packing: {0}</target>
18+
<note />
19+
</trans-unit>
520
<trans-unit id="AssetsFileDoesNotHaveValidPackageSpec">
621
<source>The assets file found does not contain a valid package spec. Try restoring the project again. The location of the assets file is {0}.</source>
722
<target state="translated">Soubor prostředků, který se našel, neobsahuje platnou specifikaci balíčku. Zkuste projekt obnovit znovu. Umístění souboru prostředků je {0}.</target>
@@ -12,6 +27,12 @@
1227
<target state="translated">Soubor prostředků, který se měl vytvořit při obnovování, neexistuje. Zkuste projekt obnovit znovu. Očekávané umístění souboru prostředků je {0}.</target>
1328
<note>{0} is the path to the assets file.</note>
1429
</trans-unit>
30+
<trans-unit id="DuplicateFrameworks">
31+
<source>This project is using aliased frameworks, the following TargetFramework properties map to the same effective frameworks '{0}' and pack is unable to disambiguate and create a single package. {1}</source>
32+
<target state="new">This project is using aliased frameworks, the following TargetFramework properties map to the same effective frameworks '{0}' and pack is unable to disambiguate and create a single package. {1}</target>
33+
<note>0 - details about which framework
34+
1 - Additional details</note>
35+
</trans-unit>
1536
<trans-unit id="Error_FileNotFound">
1637
<source>The file '{0}' to be packed was not found on disk.</source>
1738
<target state="translated">Soubor {0}, který se má zabalit, se na disku nenašel.</target>

src/NuGet.Core/NuGet.Build.Tasks.Pack/xlf/Strings.de.xlf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="de" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AmbigiousFrameworkReferences">
6+
<source>Ambiguous framework references. The following target frameworks are both declaring framework references for packing: {0}</source>
7+
<target state="new">Ambiguous framework references. The following target frameworks are both declaring framework references for packing: {0}</target>
8+
<note>0 - List of TargetFramework with framework refs</note>
9+
</trans-unit>
10+
<trans-unit id="AmbigiousPackageAssemblies">
11+
<source>Ambiguous packaging content. The above frameworks have the same target path for {0}.</source>
12+
<target state="new">Ambiguous packaging content. The above frameworks have the same target path for {0}.</target>
13+
<note />
14+
</trans-unit>
15+
<trans-unit id="AmbigiousPackageDependencies">
16+
<source>Ambiguous package dependencies. The following target frameworks are both declaring package dependencies for packing: {0}</source>
17+
<target state="new">Ambiguous package dependencies. The following target frameworks are both declaring package dependencies for packing: {0}</target>
18+
<note />
19+
</trans-unit>
520
<trans-unit id="AssetsFileDoesNotHaveValidPackageSpec">
621
<source>The assets file found does not contain a valid package spec. Try restoring the project again. The location of the assets file is {0}.</source>
722
<target state="translated">Die gefundene Assetdatei enthält keine gültige Paketspezifikation (spec). Versuchen Sie erneut, das Paket wiederherzustellen. Der Speicherort der Assetdatei ist "{0}".</target>
@@ -12,6 +27,12 @@
1227
<target state="translated">Die durch die Wiederherstellung generierte Assetdatei ist nicht vorhanden. Versuchen Sie erneut, das Projekt wiederherzustellen. Der erwartete Speicherort für die Assetdatei ist "{0}".</target>
1328
<note>{0} is the path to the assets file.</note>
1429
</trans-unit>
30+
<trans-unit id="DuplicateFrameworks">
31+
<source>This project is using aliased frameworks, the following TargetFramework properties map to the same effective frameworks '{0}' and pack is unable to disambiguate and create a single package. {1}</source>
32+
<target state="new">This project is using aliased frameworks, the following TargetFramework properties map to the same effective frameworks '{0}' and pack is unable to disambiguate and create a single package. {1}</target>
33+
<note>0 - details about which framework
34+
1 - Additional details</note>
35+
</trans-unit>
1536
<trans-unit id="Error_FileNotFound">
1637
<source>The file '{0}' to be packed was not found on disk.</source>
1738
<target state="translated">Die im Paket einzubeziehende Datei "{0}" wurde auf dem Datenträger nicht gefunden.</target>

src/NuGet.Core/NuGet.Build.Tasks.Pack/xlf/Strings.es.xlf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
33
<file datatype="xml" source-language="en" target-language="es" original="../Strings.resx">
44
<body>
5+
<trans-unit id="AmbigiousFrameworkReferences">
6+
<source>Ambiguous framework references. The following target frameworks are both declaring framework references for packing: {0}</source>
7+
<target state="new">Ambiguous framework references. The following target frameworks are both declaring framework references for packing: {0}</target>
8+
<note>0 - List of TargetFramework with framework refs</note>
9+
</trans-unit>
10+
<trans-unit id="AmbigiousPackageAssemblies">
11+
<source>Ambiguous packaging content. The above frameworks have the same target path for {0}.</source>
12+
<target state="new">Ambiguous packaging content. The above frameworks have the same target path for {0}.</target>
13+
<note />
14+
</trans-unit>
15+
<trans-unit id="AmbigiousPackageDependencies">
16+
<source>Ambiguous package dependencies. The following target frameworks are both declaring package dependencies for packing: {0}</source>
17+
<target state="new">Ambiguous package dependencies. The following target frameworks are both declaring package dependencies for packing: {0}</target>
18+
<note />
19+
</trans-unit>
520
<trans-unit id="AssetsFileDoesNotHaveValidPackageSpec">
621
<source>The assets file found does not contain a valid package spec. Try restoring the project again. The location of the assets file is {0}.</source>
722
<target state="translated">El archivo de recursos encontrado no contiene una spec de paquete válida. Intente volver a restaurar el proyecto. La ubicación del archivo de recursos es {0}.</target>
@@ -12,6 +27,12 @@
1227
<target state="translated">El archivo de recursos que ha generado la restauración no existe. Intente volver a restaurar el proyecto. La ubicación esperada del archivo de recursos es {0}.</target>
1328
<note>{0} is the path to the assets file.</note>
1429
</trans-unit>
30+
<trans-unit id="DuplicateFrameworks">
31+
<source>This project is using aliased frameworks, the following TargetFramework properties map to the same effective frameworks '{0}' and pack is unable to disambiguate and create a single package. {1}</source>
32+
<target state="new">This project is using aliased frameworks, the following TargetFramework properties map to the same effective frameworks '{0}' and pack is unable to disambiguate and create a single package. {1}</target>
33+
<note>0 - details about which framework
34+
1 - Additional details</note>
35+
</trans-unit>
1536
<trans-unit id="Error_FileNotFound">
1637
<source>The file '{0}' to be packed was not found on disk.</source>
1738
<target state="translated">El archivo "{0}" que se va a empaquetar no se encuentra en el disco.</target>

0 commit comments

Comments
 (0)