Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load class from registry using COM works with ToolsVersion="2.0" but failes with ToolsVersion="4.0"

I have a c# project which use an internal vb project as COM.

When I converted the project to VS 2010 the following line Throw me an exception:

Set RTCClient_ = New RTCCORELib.RTCClient

the RTCCore.RTCClient is part of Microsoft Merge Module for RTC (RTC Client API 1.2) that you can embedded into your installation package (That in my case includes the EXE).

the RTCCore.RTCClient is the class that is being registered to registry under HKEY_CLASSES_ROOT\RTCCore.RTCClient

The error I'm getting is:

ERROR: Automation error
The specified module could not be found. (-2147024770)

But If I'm changing my csproj and using ToolsVersion="2.0" the above line works and I can get RTCClient object.

What seems to be the problem?

like image 744
Dor Cohen Avatar asked Sep 20 '12 07:09

Dor Cohen


People also ask

How do I check MSBuild ToolsVersion?

Starting in Visual Studio 2013, the MSBuild Toolset version is the same as the Visual Studio version number. MSBuild defaults to this Toolset within Visual Studio and on the command line, regardless of the Toolset version specified in the project file. This behavior can be overridden by using the -ToolsVersion flag.

Where is MSBuildToolsPath set?

$(MSBuildBinPath) is set to the ToolsPath value that is specified either in the registry or in the configuration file where the ToolsVersion is defined. The $(MSBuildToolsPath) setting in the registry or the configuration file specifies the location of the core tasks and targets.

What is MSBuildBinPath?

16.0. MSBuildBinPath. Reserved. The absolute path of the folder where the MSBuild binaries that are currently being used are located (for example, C:\Windows\Microsoft.Net\Framework\<versionNumber>). This property is useful if you have to refer to files in the MSBuild directory.

Where is MSBuildExtensionsPath?

WebApplication. targets". This file is installed by Visual Studio to the standard $(MSBuildExtensionsPath) location (C:\Program Files\MSBuild).


1 Answers

Try setting Embed Interop Types to false in the properties of the reference to your COM library in the project. Mine is C#, but your VB.Net may have it as well.

Properties window

like image 196
user195275 Avatar answered Sep 18 '22 07:09

user195275