tlbimp

Visual Studio 2010, TlbImp generates .net 4.0 interops in 2.0 projects

荒凉一梦 提交于 2019-12-01 02:26:52
In a C# project we add a reference to a COM object via the Add References setup pointing to a COM object which results in the IDE auto-generating the interop assembly. So this is fine and good, but we are building based on .net 3.5 SP1 aka CLR 2.0, and the generated interops are using the 4.0 CLR making them incompatible. Is there a way to prevent this? I assume the other option is configure our build script to try using tlbimp.exe with the /references parameter? to point to mscorlib v2.0? Anyhow, I'm hoping there's a flag somewhere to allow this. I encountered exactly this issue. The solution

How to CreateObject in C#?

别说谁变了你拦得住时间么 提交于 2019-12-01 01:10:16
I want to translate the following VB6 code into C# If optHost(0).Value Then Set m_oScpiAccess = New IcSCPIActiveX.IcSCPIAccess Else sHost = txtHost.Text Set m_oScpiAccess = CreateObject("Exfo.IcSCPIActiveX.IcSCPIAccess", sHost) End If I used TlbImp.exe to create wrappers for the COM classes, and I tried: if (string.IsNullOrEmpty(host)) { // this works IcSCPIAccess = new IcSCPIAccess(); } else { // throws MissingMethodException IcSCPIAccess = (IcSCPIAccess)Activator.CreateInstance( typeof(IcSCPIAccessClass), host); } But there is no constructor which accepts the host parameter It is not a

Visual Studio 2010, TlbImp generates .net 4.0 interops in 2.0 projects

早过忘川 提交于 2019-11-30 22:01:09
问题 In a C# project we add a reference to a COM object via the Add References setup pointing to a COM object which results in the IDE auto-generating the interop assembly. So this is fine and good, but we are building based on .net 3.5 SP1 aka CLR 2.0, and the generated interops are using the 4.0 CLR making them incompatible. Is there a way to prevent this? I assume the other option is configure our build script to try using tlbimp.exe with the /references parameter? to point to mscorlib v2.0?

Manually generate ActiveX wrapper after TLBIMP-ed dlls?

有些话、适合烂在心里 提交于 2019-11-30 18:38:13
问题 I have several ActiveX components that needed to be accessed from a C# project. I can import them via Visual Studio's add reference dialog, which will also automatically generate wrappers class. (i.e. ABCLib and AxABCLib ) I know that I can generate the primary interop assembly manually by running TLBIMP /primary on each individual OCX file but I could not find a way to generate the ActiveX wrapper unless I do it via Visual Studio user interface. Is there a command-line version that generate

Lots of build warnings when COM objects ActiveDs or MSXML2 are referenced

元气小坏坏 提交于 2019-11-30 11:59:58
After moving a project from .NET 1.1 to .NET 2.0, MsBuild emits lots of warnings for some COM objects. Sample code for test (actual code doesn't matter, just used to create the warnings): using System; using System.DirectoryServices; using ActiveDs; namespace Test { public class Class1 { public static void Main(string[] args) { string adsPath = String.Format("WinNT://{0}/{1}", args[0], args[1]); DirectoryEntry localuser = new DirectoryEntry(adsPath); IADsUser pUser = (IADsUser) localuser.NativeObject; Console.WriteLine("User = {0}", pUser.ADsPath); } } } Warning messages look like C:\WINDOWS

Lots of build warnings when COM objects ActiveDs or MSXML2 are referenced

ぃ、小莉子 提交于 2019-11-29 17:37:28
问题 After moving a project from .NET 1.1 to .NET 2.0, MsBuild emits lots of warnings for some COM objects. Sample code for test (actual code doesn't matter, just used to create the warnings): using System; using System.DirectoryServices; using ActiveDs; namespace Test { public class Class1 { public static void Main(string[] args) { string adsPath = String.Format("WinNT://{0}/{1}", args[0], args[1]); DirectoryEntry localuser = new DirectoryEntry(adsPath); IADsUser pUser = (IADsUser) localuser