diff --git a/README.md b/README.md index 7963590d..a0ff147e 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,7 @@ The build task consumes the following [items](https://learn.microsoft.com/en-us/ | DsComTlbExportTlbReferences | Referenced type library files. | | DsComTlbExportReferencePaths | Directories containing type libraries to use for export. | | DsComTlbExportAssemblyPaths | Assemblies to add for the export. | +| DsComTlbAliasNames | Names to use as aliases for types with aliases. | ### Example diff --git a/src/dscom.build/TlbExport.cs b/src/dscom.build/TlbExport.cs index 33b145cd..117c6827 100644 --- a/src/dscom.build/TlbExport.cs +++ b/src/dscom.build/TlbExport.cs @@ -88,6 +88,11 @@ public TlbExport() : this(new DefaultBuildContext()) /// public ITaskItem[] AssemblyPaths { get; set; } = Array.Empty(); + /// + /// Gets or sets the names to map to a new resolved name. + /// + public string[] Names { get; set; } = Array.Empty(); + /// public override bool Execute() { @@ -171,6 +176,8 @@ private bool ExecuteTask() checks.VerifyDirectoriesPresent(settings.TLBRefpath, false, ref result); checks.VerifyFilesPresent(settings.ASMPath, false, ref result); + settings.Names = Names ?? Array.Empty(); + // run conversion, if result has been successful. result = result && _context.ConvertAssemblyToTypeLib(settings, Log); diff --git a/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Task.targets b/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Task.targets index 8537178c..44596798 100644 --- a/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Task.targets +++ b/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Task.targets @@ -45,6 +45,7 @@ SourceAssemblyFile="$(_DsComExportTypeLibraryAssemblyFile)" TypeLibraryReferences="@(DsComTlbExportTlbReferences)" TypeLibraryReferencePaths="@(DsComTlbExportReferencePaths)" - AssemblyPaths="@(DsComTlbExportAssemblyPaths)" /> + AssemblyPaths="@(DsComTlbExportAssemblyPaths)" + Names="@(DsComTlbAliasNames)" /> \ No newline at end of file diff --git a/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Tools.targets b/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Tools.targets index d82b5ba9..5b6a7f23 100644 --- a/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Tools.targets +++ b/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.Tools.targets @@ -44,6 +44,7 @@ <_DsComTypeLibraryReferencePaths Condition="@(DsComTlbExportReferencePaths->Count()) > 0">--tlbrefpath "@(DsComTlbExportReferencePaths, '"--tlbrefpath "')" <_DsComAssemblyReferences Condition="@(_DsComTlbExportAssemblyPathsWithoutHintPath->Count()) > 0">--asmpath "@(_DsComTlbExportAssemblyPathsWithoutHintPath, '"--asmpath "')" <_DsComAssemblyReferences Condition="@(_DsComTlbExportAssemblyPathsWithHintPath->Count()) > 0">--asmpath "@(_DsComTlbExportAssemblyPathsWithHintPath->GetMetadata('HintPath'), '"--asmpath "')" + <_DsComAliasNames Condition="@(DsComTlbAliasNames->Count() > 0)">--names @(DsComTlbAliasNames, --names) <_DsComArguments>tlbexport <_DsComArguments Condition="'$(DsComTypeLibraryUniqueId)' != '' AND '$(DsComTypeLibraryUniqueId)' != '$([System.Guid]::Empty.ToString())'">$(_DsComArguments) --overridetlbid "$(DsComTypeLibraryUniqueId)" <_DsComArguments Condition="'$(DsComToolVerbose)' == 'true'"> $(_DsComArguments) --verbose @@ -51,6 +52,7 @@ <_DsComArguments> $(_DsComArguments) $(_DsComTypeLibraryReferences) <_DsComArguments> $(_DsComArguments) $(_DsComTypeLibraryReferencePaths) <_DsComArguments> $(_DsComArguments) $(_DsComExportTypeLibraryAssemblyFile) + <_DsComArguments> $(_DsComArguments) $(_DsComAliasNames) <_DsComArguments> $(_DsComArguments) --out $(_DsComExportTypeLibraryTargetFile) diff --git a/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.props b/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.props index 5c55c979..c1c8ce7f 100644 --- a/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.props +++ b/src/dscom.build/dSPACE.Runtime.InteropServices.BuildTasks.props @@ -42,5 +42,6 @@ + \ No newline at end of file