HShbib
HShbib

Reputation: 1841

Converting .cs class file to .dll

I am trying to convert the famous BingSearchContainer.cs class file to .dll so that I can use it in a vb.net project. I have read and followed every single step mentioned in here

http://footyntech.wordpress.com/2011/07/27/creating-and-using-dll-files/

however when I compile it gives me several errors shown in the bottom screenshot enter image description here

I also tried to change the .NET Framework from 3.5 to 4.0 and vise versa, but without luck.

Any thoughts or suggestions ?

Upvotes: 2

Views: 4410

Answers (2)

slfan
slfan

Reputation: 9129

You have to reference the required assemblies used by your code, e.g. System.Data.dll. With the command line Compiler you do that with the switch /r

csc /target:library /r:System.Data.dll /r:System.Data.Services.Client.dll /out:Student.dll BingSearchContainer.cs  

For every data type that is missing you have to check in the MSDN in which assembly this data type is and add it to the list.

Upvotes: 5

Dana Cartwright
Dana Cartwright

Reputation: 1576

From this article: http://weblogs.asp.net/sreejukg/archive/2012/07/04/integrate-bing-search-api-to-asp-net-application.aspx

It looks to me like you're missing this part:

To build the code file you need to add reference to the following library. System.Data.Services.Client

On my system at least, this assembly is located at:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.Services.Client.dll

So you will need to go get System.Data.Services.Client from there and copy it to your local build folder. Then add /reference:System.Data.Services.Client to your command line for csc. Or, of course, just use Visual Studio and use the .NET tab of "Add Reference..." for the project to add a reference to System.Data.Services.Client.

Upvotes: 2

Related Questions