473,568 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using a ASSEMBLY

General:
- Using C#
- Using notepad to program (NOT Visual Studio).

I have a code-behind file name 'example1.cs'. I want to use an Assembly
given to me for a project I'm working on. I have put the assembly named
'assembly1.dll' in the /bin directory.

How do I import/load etc the assembly so that I can use it in example1.cs?

Thanks in advance
Nov 17 '05 #1
3 1844
Hi michael,

You will need to specify the /r parameter to reference the assembly1.dll
when using csc.exe to compile your assembly.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.

"michael" <mp********@sbc global.net> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
General:
- Using C#
- Using notepad to program (NOT Visual Studio).

I have a code-behind file name 'example1.cs'. I want to use an Assembly
given to me for a project I'm working on. I have put the assembly named
'assembly1.dll' in the /bin directory.

How do I import/load etc the assembly so that I can use it in example1.cs?

Thanks in advance

Nov 17 '05 #2
Victor,

What I want to do is the following:

/bin/given_assembly. dll

/example.cs
---------------------------------
Using given_assembly. dll // <---- ????????

public class ExampleClass {
GivenAssemblyCl ass ac = GivenAssemblyCl ass();
}
-----------------------------------

But of course, since the GivenAssemblyCl ass is in the given_assembly. dll and
not in the ExampleClass - it doesn't know what GivenAssemblyCl ass is. How
do I 'import' the assembly so that it can be used in 'example.cs'?

Thanks again

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Hi michael,

You will need to specify the /r parameter to reference the assembly1.dll
when using csc.exe to compile your assembly.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.

"michael" <mp********@sbc global.net> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
General:
- Using C#
- Using notepad to program (NOT Visual Studio).

I have a code-behind file name 'example1.cs'. I want to use an Assembly
given to me for a project I'm working on. I have put the assembly named
'assembly1.dll' in the /bin directory.

How do I import/load etc the assembly so that I can use it in example1.cs?
Thanks in advance


Nov 17 '05 #3
There are two different steps:

1) You could add (not required) "using" statements at the top of your
example.cs file so you don't have to specify the full names when referencing
types defined in given_assembly. dll all along example.cs, ie:

using SomeNamespaceFr omGivenAssembly ;

ATypeFromGivenN amespace a = new ATypeFromGivenN amespace();

the using just saved you from having to do:

SomeNamespaceFr omGivenAssembly .ATypeFromGiven Namespace a = new
SomeNamespaceFr omGivenAssembly .ATypeFromGiven Namespace ();

Now for this to compile you will need to specify the /r parameter to csc.exe
so the compiler can resolve type references, ie:

csc.exe YourApp.cs /r:GivenAssembly .dll

With /r the compiler will be able to find
SomeNamespaceFr omGivenAssembly .ATypeFromGiven Namespace in givenassembly.d ll
and will compile your code ok.

Is this clear now? If the problem is you don't know exactly what namespaces
and types GivenAssembly offers you, then you could use a tool like Reflector
to inspect it,
--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.

"michael" <mp********@sbc global.net> wrote in message
news:OJ******** ******@TK2MSFTN GP11.phx.gbl...
Victor,

What I want to do is the following:

/bin/given_assembly. dll

/example.cs
---------------------------------
Using given_assembly. dll // <---- ????????

public class ExampleClass {
GivenAssemblyCl ass ac = GivenAssemblyCl ass();
}
-----------------------------------

But of course, since the GivenAssemblyCl ass is in the given_assembly. dll and not in the ExampleClass - it doesn't know what GivenAssemblyCl ass is. How
do I 'import' the assembly so that it can be used in 'example.cs'?

Thanks again

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Hi michael,

You will need to specify the /r parameter to reference the assembly1.dll
when using csc.exe to compile your assembly.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.

"michael" <mp********@sbc global.net> wrote in message
news:ef******** ******@tk2msftn gp13.phx.gbl...
General:
- Using C#
- Using notepad to program (NOT Visual Studio).

I have a code-behind file name 'example1.cs'. I want to use an Assembly given to me for a project I'm working on. I have put the assembly named 'assembly1.dll' in the /bin directory.

How do I import/load etc the assembly so that I can use it in

example1.cs?
Thanks in advance



Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9394
by: Mountain Bikn' Guy | last post by:
This code (adapted from the examples in the docs) doesn't make complete sense to me. I have it working, but I'm wondering why I need to declare an assembly reference in 2 places. TIA. Dave CodeCompileUnit compileUnit = new CodeCompileUnit(); CodeNamespace myNamespace = new CodeNamespace("MyNamespace"); compileUnit.Namespaces.Add(...
43
2599
by: nospam | last post by:
I got three (3) files (1) Untitled.aspx (2) Untitled.aspx.1.cs (3) Untitled.aspx.2.cs These three files must be used together to make file #1, Untitled.aspx, page work via J.I.T. when the User first hits Internet Explorer 6.0 on your browser.
3
1081
by: TT (Tom Tempelaere) | last post by:
Hi there I am making a service project in C#, and I'm in the process of writing the installer. I made an installer class by using the "Add Installer" menu-item in the design window of the service, then I configured the properties of the installers When I run InstallUtil on the executable, it fails with the following message "An exception...
1
1779
by: Marc Falesse | last post by:
Hello, My application needs to serialize a class, which was generated with xsd.exe from a XSD. It was working .NET 1.1 and it is working with .NET 2.0 very well. Now I need my assembly to be a plugin, and to be called by reflexion, but I get this Exception: Exception.Message: "There was an error generating the XML document."
3
5075
by: Michael Hoehne | last post by:
Hi, I'm currently facing a problem with a mixed environment using .NET 1.1 and ..NET 2.0 web services. We have a client application (the "client", system 1) running on .NET 2.0/WinXP, calling our web service (The "Web Service Server") running on a separate machine (also .NET 2.0, Win2003 Server, system 2). The web service server...
3
2827
by: Siv | last post by:
Hi, A little while ago I wrote a small program that allowed the user to view products from a database. The database holds the details of the products which can be viewed via a form and additionally pictures of the product are stored in an images subfolder and the database holds the file name of the relevant picture. The user can then click a...
0
1623
by: Bill Nguyen | last post by:
I ran into this error using ClickOne to deploy a .NET 2.0 app. CrystalReports for .NET 2.0 is included in the delployment. The error indicates that an incorrect version of CrystalReports.Engine DLL is added to the client GAC. My question is how to obtain a correct redistributable package of R10 so that I can automate the delpoyment. ...
17
6243
by: Janiv Ratson | last post by:
Hello, I have written a C# dll in VS2005. One interface and class are exported using Interop Services. I want to use this c# dll in my MFC application, using VS2003. It compiles after I imported the dll to my MFC app. On runtime I get class not registered HR error in my MFC project. I use the code as follow: _NewActivationPtr myActivation...
0
1342
by: per9000 | last post by:
Hi all, we use CVS to manage versions of our code. Since the CVS keeps track of everything we need I want to synchronize the assembly info with CVS. The problem is that if I update the assembly info the file is no longer up-to-date with our CVS-repository. Also if I check the file in to the CVS-repository the assembly info is no longer...
3
4282
by: shobhitguptait | last post by:
How to Run C#.NET Windows App on N/W with centralized DB using SQL SERVER 2000 Hello All...i m really grate full to c such a website where developers try to help people like us who face problems in s/w develepment...I am shobhit Gupta...23 years of age prusuing B.Tech in I.T. Engg. Final Year from Kurukshetra University, Kurukshetra. Recently,...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7916
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6275
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.