<ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
<FrameworkListFileProfile Include="Accessibility.dll" Profile="WindowsForms;WPF" />
- <FrameworkListFileProfile Include="D3DCompiler_47_cor3.dll" Profile="WPF" />
- <FrameworkListFileProfile Include="DirectWriteForwarder.dll" Profile="WPF" />
<FrameworkListFileProfile Include="Microsoft.Win32.Registry.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="Microsoft.Win32.SystemEvents.dll" Profile="WindowsForms;WPF" />
- <FrameworkListFileProfile Include="PenImc_cor3.dll" Profile="WPF" />
- <FrameworkListFileProfile Include="PresentationCore-CommonResources.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationCore.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework-SystemCore.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework-SystemData.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.Luna.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationFramework.Royale.dll" Profile="WPF" />
- <FrameworkListFileProfile Include="PresentationNative_cor3.dll" Profile="WPF" />
<FrameworkListFileProfile Include="PresentationUI.dll" Profile="WPF" />
<FrameworkListFileProfile Include="ReachFramework.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.CodeDom.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Configuration.ConfigurationManager.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Design.dll" Profile="WindowsForms" />
- <FrameworkListFileProfile Include="System.Diagnostics.EventLog.dll" Profile="WindowsForms;WPF" />
- <FrameworkListFileProfile Include="System.DirectoryServices.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Drawing.Common.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Drawing.Design.dll" Profile="WindowsForms" />
- <FrameworkListFileProfile Include="System.Drawing.Design.Primitives.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="System.Drawing.dll" Profile="WindowsForms" />
- <FrameworkListFileProfile Include="System.IO.FileSystem.AccessControl.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.IO.Packaging.dll" Profile="WindowsForms;WPF" />
- <FrameworkListFileProfile Include="System.Media.SoundPlayer.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Printing.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.Resources.Extensions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.AccessControl.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Cryptography.Xml.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Permissions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Security.Principal.Windows.dll" Profile="WindowsForms;WPF" />
- <FrameworkListFileProfile Include="System.Threading.AccessControl.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Windows.Controls.Ribbon.dll" Profile="WPF" />
<FrameworkListFileProfile Include="System.Windows.Extensions.dll" Profile="WindowsForms;WPF" />
<FrameworkListFileProfile Include="System.Windows.Forms.Design.dll" Profile="WindowsForms" />
<FrameworkListFileProfile Include="UIAutomationClientSideProviders.dll" Profile="WPF" />
<FrameworkListFileProfile Include="UIAutomationProvider.dll" Profile="WPF" />
<FrameworkListFileProfile Include="UIAutomationTypes.dll" Profile="WPF" />
- <FrameworkListFileProfile Include="vcruntime140_cor3.dll" Profile="WPF" />
<FrameworkListFileProfile Include="WindowsBase.dll" Profile="WPF" />
- <FrameworkListFileProfile Include="WPFgfx_cor3.dll" Profile="WPF" />
-
- <!-- If any of these files has resource dlls, use the file's profile. -->
- <FrameworkListFileProfile Include="@(FrameworkListFileProfile -> '%(Filename).resources%(Extension)')" />
+ <FrameworkListFileProfile Include="WindowsFormsIntegration.dll" />
</ItemGroup>
<!-- Redistribute package content from other nuget packages. -->
public ITaskItem[] Files { get; set; }
/// <summary>
- /// A list of assembly names to add Profile="%(Profile)" attributes to, if the assembly
- /// names exist in Files.
- ///
+ /// A list of assembly names with Profile classifications. A Profile="%(Profile)" attribute
+ /// is set in the framework list for the matching Files item if %(Profile) contains text.
+ ///
+ /// If *any* FileProfiles are passed:
+ ///
+ /// *Every* file that ends up listed in the framework list must have a matching
+ /// FileProfile, even if %(Profile) is not set.
+ ///
+ /// Additionally, every FileProfile must find exactly one File.
+ ///
+ /// This task fails if the conditions aren't met. This ensures the classification doesn't
+ /// become out of date when the list of files changes.
+ ///
/// %(Identity): Assembly name (including ".dll").
/// %(Profile): List of profiles that apply, semicolon-delimited.
/// </summary>
var frameworkManifest = new XElement("FileList", rootAttributes);
- Dictionary<string, string> fileProfileLookup = (FileProfiles ?? Array.Empty<ITaskItem>())
- .ToDictionary(
+ Dictionary<string, string> fileProfileLookup = FileProfiles
+ ?.ToDictionary(
item => item.ItemSpec,
item => item.GetMetadata("Profile"),
StringComparer.OrdinalIgnoreCase);
+ var usedFileProfiles = new HashSet<string>();
+
foreach (var f in Files
.Where(IsTargetPathIncluded)
.Select(item => new
element.Add(new XAttribute("FileVersion", f.FileVersion));
- if (fileProfileLookup.TryGetValue(f.Filename, out string profile))
+ if (fileProfileLookup != null)
{
- element.Add(new XAttribute("Profile", profile));
+ if (fileProfileLookup.TryGetValue(f.Filename, out string profile))
+ {
+ if (!string.IsNullOrEmpty(profile))
+ {
+ element.Add(new XAttribute("Profile", profile));
+ }
+
+ usedFileProfiles.Add(f.Filename);
+ }
+ else
+ {
+ Log.LogError($"File matches no profile classification: {f.Filename}");
+ }
}
frameworkManifest.Add(element);
}
+ foreach (var unused in fileProfileLookup
+ ?.Keys.Except(usedFileProfiles).OrderBy(p => p)
+ ?? Enumerable.Empty<string>())
+ {
+ Log.LogError($"Profile classification matches no files: {unused}");
+ }
+
Directory.CreateDirectory(Path.GetDirectoryName(TargetFile));
File.WriteAllText(TargetFile, frameworkManifest.ToString());