有趣...看起来需要一些残留的 ProgId 东西才能使 mt.exe 开心。具体如下*.rgs
HKCR
{
AtlObjectProgId.1 = s 'AtlObject Class'
{
CLSID = s '{2371607D-284A-4D7C-A6DD-20C15373F43F}'
}
NoRemove CLSID
{
ForceRemove {2371607D-284A-4D7C-A6DD-20C15373F43F} = s 'AtlObject Class'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Free'
}
}
}
}
产生以下*.embed.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><file name="ATLProject2.dll" hashalg="SHA1"><comClass clsid="{2371607D-284A-4D7C-A6DD-20C15373F43F}" tlbid="{92B1424C-0D03-4909-99DC-2A70EFD210D5}" threadingModel="Free"></comClass><typelib tlbid="{92B1424C-0D03-4909-99DC-2A70EFD210D5}" version="1.0" helpdir="" flags="HASDISKIMAGE"></typelib></file><comInterfaceExternalProxyStub name="IAtlObject" iid="{81A8B3DA-2AFE-4C25-B0ED-CDD777FB01A4}" tlbid="{92B1424C-0D03-4909-99DC-2A70EFD210D5}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub></assembly>
而以下*.rgs
HKCR
{
NoRemove CLSID
{
ForceRemove {2371607D-284A-4D7C-A6DD-20C15373F43F} = s 'AtlObject Class'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Free'
}
}
}
}
产生以下*.embed.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><file name="ATLProject2.dll" hashalg="SHA1"><comClass clsid="{2371607D-284A-4D7C-A6DD-20C15373F43F}" tlbid="{92B1424C-0D03-4909-99DC-2A70EFD210D5}"></comClass><typelib tlbid="{92B1424C-0D03-4909-99DC-2A70EFD210D5}" version="1.0" helpdir="" flags="HASDISKIMAGE"></typelib></file><comInterfaceExternalProxyStub name="IAtlObject" iid="{81A8B3DA-2AFE-4C25-B0ED-CDD777FB01A4}" tlbid="{92B1424C-0D03-4909-99DC-2A70EFD210D5}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub></assembly>
编辑:这似乎有效,但它仅适用于*.rgs
文件中的第一个类。例如,以下*.rgs
HKCR
{
AtlObj1ProgId.1 = s 'AtlObj1 Class'
{
CLSID = s '{D15A646A-4F2F-42C2-BA8B-780AABCFB133}'
}
AtlObj1ProgId = s 'AtlObj1 Class'
{
CurVer = s 'AtlObj1ProgId.1'
}
NoRemove CLSID
{
ForceRemove {D15A646A-4F2F-42C2-BA8B-780AABCFB133} = s 'AtlObj1 Class'
{
ProgID = s 'AtlObj1ProgId.1'
VersionIndependentProgID = s 'AtlObj1ProgId'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Neutral'
}
TypeLib = s '{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}'
Version = s '1.0'
}
}
AltObj2ProgId.1 = s 'AtlObj2 Class'
{
CLSID = s '{C208B430-8E12-4C65-AA5A-899F6AB13C4B}'
}
AltObj2ProgId = s 'AtlObj2 Class'
{
CurVer = s 'AltObj2ProgId.1'
}
NoRemove CLSID
{
ForceRemove {C208B430-8E12-4C65-AA5A-899F6AB13C4B} = s 'AtlObj2 Class'
{
ProgID = s 'AltObj2ProgId.1'
VersionIndependentProgID = s 'AltObj2ProgId'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Neutral'
}
TypeLib = s '{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}'
Version = s '1.0'
}
}
}
产生以下*.embed.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><file name="RgsClass2.dll" hashalg="SHA1"><comClass clsid="{D15A646A-4F2F-42C2-BA8B-780AABCFB133}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" threadingModel="Neutral" progid="AltObj2ProgId"><progid>AtlObj1ProgId.1</progid><progid>AltObj2ProgId.1</progid></comClass><comClass clsid="{C208B430-8E12-4C65-AA5A-899F6AB13C4B}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}"></comClass><typelib tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" version="1.0" helpdir="" flags="HASDISKIMAGE"></typelib></file><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo><comInterfaceExternalProxyStub name="IAtlObj1" iid="{FF2A4D47-DADA-451E-8125-610643B00FBC}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub><comInterfaceExternalProxyStub name="IAtlObj2" iid="{F9226919-2AB7-4DBE-9F79-092839480351}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub></assembly>
请注意,只有第一个 CoClass 有一个 threadingModel(或就此而言的 ProgId)。
编辑:成功!以下*.rgs
HKCR
{
AtlObj1ProgId.1 = s 'AtlObj1 Class'
{
CLSID = s '{D15A646A-4F2F-42C2-BA8B-780AABCFB133}'
}
NoRemove CLSID
{
ForceRemove {D15A646A-4F2F-42C2-BA8B-780AABCFB133} = s 'AtlObj1 Class'
{
ProgID = s 'AtlObj1ProgId.1'
VersionIndependentProgID = s 'AtlObj1ProgId'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Neutral'
}
TypeLib = s '{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}'
Version = s '1.0'
}
}
}
HKCR
{
AltObj2ProgId.1 = s 'AtlObj2 Class'
{
CLSID = s '{C208B430-8E12-4C65-AA5A-899F6AB13C4B}'
}
NoRemove CLSID
{
ForceRemove {C208B430-8E12-4C65-AA5A-899F6AB13C4B} = s 'AtlObj2 Class'
{
ProgID = s 'AltObj2ProgId.1'
VersionIndependentProgID = s 'AltObj2ProgId'
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Neutral'
}
TypeLib = s '{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}'
Version = s '1.0'
}
}
}
产生以下*.embed.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><file name="RgsClass2.dll" hashalg="SHA1"><comClass clsid="{D15A646A-4F2F-42C2-BA8B-780AABCFB133}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" threadingModel="Neutral" progid="AtlObj1ProgId"><progid>AtlObj1ProgId.1</progid></comClass><comClass clsid="{C208B430-8E12-4C65-AA5A-899F6AB13C4B}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" threadingModel="Neutral" progid="AltObj2ProgId"><progid>AltObj2ProgId.1</progid></comClass><typelib tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" version="1.0" helpdir="" flags="HASDISKIMAGE"></typelib></file><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel></requestedPrivileges></security></trustInfo><comInterfaceExternalProxyStub name="IAtlObj1" iid="{FF2A4D47-DADA-451E-8125-610643B00FBC}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub><comInterfaceExternalProxyStub name="IAtlObj2" iid="{F9226919-2AB7-4DBE-9F79-092839480351}" tlbid="{85D8EC5E-3C24-4151-83D9-34CCE9A1E534}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"></comInterfaceExternalProxyStub></assembly>