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