diff --git a/ILRepack.Lib.MSBuild.Task/ILRepack.Lib.MSBuild.Task.csproj b/ILRepack.Lib.MSBuild.Task/ILRepack.Lib.MSBuild.Task.csproj index a37722d..4a3fbbd 100644 --- a/ILRepack.Lib.MSBuild.Task/ILRepack.Lib.MSBuild.Task.csproj +++ b/ILRepack.Lib.MSBuild.Task/ILRepack.Lib.MSBuild.Task.csproj @@ -2,12 +2,12 @@ net472 - 2.0.26 + 2.0.29 - - + + diff --git a/ILRepack.Lib.MSBuild.Task/ILRepack.cs b/ILRepack.Lib.MSBuild.Task/ILRepack.cs index 7d703a7..ef41287 100644 --- a/ILRepack.Lib.MSBuild.Task/ILRepack.cs +++ b/ILRepack.Lib.MSBuild.Task/ILRepack.cs @@ -143,6 +143,11 @@ public virtual string TargetKind /// public virtual ITaskItem[] InternalizeExclude { get; set; } + /// + /// List of specific assemblies to internalize. + /// + public virtual ITaskItem[] InternalizeAssembly { get; set; } + /// /// Output name for the merged assembly. /// @@ -321,6 +326,11 @@ public override bool Execute() repackOptions.InputAssemblies = assemblies; + if (InternalizeAssembly != null && InternalizeAssembly.Any()) + { + repackOptions.InternalizeAssemblies = InternalizeAssembly.Select(i => StripExtension(i.ItemSpec)).ToArray(); + } + // Path that will be used when searching for assemblies to merge. var searchPath = new List { "." }; searchPath.AddRange(LibraryPath.Select(iti => BuildPath(iti.ItemSpec))); @@ -393,6 +403,26 @@ private static string BuildPath(string path) return string.IsNullOrEmpty(path) ? null : Path.Combine(workDir, path); } + /// + /// Strips .dll or .exe extension from filePath if present. + /// + /// File path + /// File path without the extension. + private static string StripExtension(string filePath) + { + if (filePath == null) + { + return null; + } + + if (filePath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) || filePath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase)) + { + filePath = filePath.Substring(0, filePath.Length - 4); + } + + return filePath; + } + #endregion #region IDisposable diff --git a/ILRepack.Lib.MSBuild.Task/build/ILRepack.Lib.MSBuild.Task.nuspec b/ILRepack.Lib.MSBuild.Task/build/ILRepack.Lib.MSBuild.Task.nuspec index 2816323..d92ca75 100644 --- a/ILRepack.Lib.MSBuild.Task/build/ILRepack.Lib.MSBuild.Task.nuspec +++ b/ILRepack.Lib.MSBuild.Task/build/ILRepack.Lib.MSBuild.Task.nuspec @@ -2,7 +2,7 @@ ILRepack.Lib.MSBuild.Task - 2.0.26 + 2.0.29 ILRepack.Lib.MSBuild.Task RBSoft rbsoft diff --git a/README.md b/README.md index a7d5882..81bac5c 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ You can turn this functionality off by setting ClearOutputDirectory to False as | XmlDocumentation | Merge assembly XML documentation. | | LibraryPath | List of paths to use as "include directories" when attempting to merge assemblies. | | Internalize | Set all types but the ones from the first assembly 'internal'. | +| InternalizeAssembly | Internalize only specific assemblies (list of assembly names without path or extension). | | RenameInternalized | Rename all internalized types (to be used when Internalize is enabled). | | ExcludeInternalizeSerializable | Do not internalize types marked as Serializable. | | InternalizeExclude | If Internalize is set to true, any which match these regular expressions will not be internalized. If Internalize is false, then this property is ignored. | diff --git a/appveyor.yml b/appveyor.yml index a931433..2d2f2bb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ -version: 2.0.26.{build} +version: 2.0.29.{build} environment: - my_version: 2.0.26 + my_version: 2.0.29 my_secret: secure: 5qtuEW0UQ/IEO8DRi4/y3EgEBoJDM/HyYpPgzasIlm0= skip_branch_with_pr: true