473,466 Members | 4,850 Online
Bytes | Software Development & Data Engineering Community
Create 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 1840
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********@sbcglobal.net> wrote in message
news:ef**************@tk2msftngp13.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 {
GivenAssemblyClass ac = GivenAssemblyClass();
}
-----------------------------------

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

Thanks again

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPAM.com> wrote in message
news:%2***************@TK2MSFTNGP10.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********@sbcglobal.net> wrote in message
news:ef**************@tk2msftngp13.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 SomeNamespaceFromGivenAssembly;

ATypeFromGivenNamespace a = new ATypeFromGivenNamespace();

the using just saved you from having to do:

SomeNamespaceFromGivenAssembly.ATypeFromGivenNames pace a = new
SomeNamespaceFromGivenAssembly.ATypeFromGivenNames pace ();

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
SomeNamespaceFromGivenAssembly.ATypeFromGivenNames pace in givenassembly.dll
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********@sbcglobal.net> wrote in message
news:OJ**************@TK2MSFTNGP11.phx.gbl...
Victor,

What I want to do is the following:

/bin/given_assembly.dll

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

public class ExampleClass {
GivenAssemblyClass ac = GivenAssemblyClass();
}
-----------------------------------

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

Thanks again

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPAM.com> wrote in message
news:%2***************@TK2MSFTNGP10.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********@sbcglobal.net> wrote in message
news:ef**************@tk2msftngp13.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
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 ...
43
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...
3
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,...
1
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...
3
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...
3
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...
0
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...
17
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...
0
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...
3
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
1
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.