|
-
Jul 8th, 2005, 07:53 AM
#1
Importing System.dll and so on.
Is it possible to add these DLLs in your code, in stead of adding them as a reference? I find it annoying every time I want to use them that i have to make a whole new solution in stead of just one file.
I tried to use DLLImort, but I guess it isn't ment to import them like this. Is there any way like in C++?
The code I tested (in case it is just Monodevelop) that don't understand it:
Code:
using System.Runtime.InteropServices;
[DllImport("System.dll")]
[DllImport("System.Drawing.dll")]
[DllImport("System.Windows.Forms.dll")]
class MessageBoxHelloWorld
{
public static void Main()
{
System.Windows.Forms.MessageBox.Show("Hello, world!");
}
}
- ØØ -
-
Jul 8th, 2005, 08:34 AM
#2
Re: Importing System.dll and so on.
using System;
using System.Drawing;
using System.Windows.Forms;
is that what you mean?
What do you mean by "i have to make a whole new solution in stead of just one file"?
I don't live here any more.
-
Jul 8th, 2005, 08:39 AM
#3
Re: Importing System.dll and so on.
I don't need those using directives since I am writing all the name spaces with dots in between in that example.
But in order to use those name spaces, I have to add DLL files as reference, since the namespaces are in the DLL files.
The problem is: Is it possible to add those with code (as in C++) or do you have to manualy add them to references in your IDE. I can't remember exactly since it has been a year ++ since I did C# in VS, but I think VS adds the references automaticaly for you, but you can see them in the solution explorer. But if you just want to make a cs file, and NOT a whole solution (with all the solution files) then you can't add references, since those are stored in the solution files. So I was wondering if you could add those DLLs with code in a .cs file.
- ØØ -
-
Jul 8th, 2005, 01:37 PM
#4
Re: Importing System.dll and so on.
in microsoft's version I believe the only way to do it is to have a project file and add the references to that. I dont think you can do it without that, unless mono allows you
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 8th, 2005, 02:41 PM
#5
Re: Importing System.dll and so on.
Well, it didn't look like it worked the way I did. I think that is only to get functions from DLLs, might try to ask on the Monodevelop mailing list on monday, if no one has a solution before that.
- ØØ -
-
Jul 8th, 2005, 04:07 PM
#6
Re: Importing System.dll and so on.
I don't thinnk this will be possible because unlike *.h header files, DLLs are already compiled. Not all DLL's are present on all computers and I think this wouldn't work.
$0.02
I don't live here any more.
-
Jul 8th, 2005, 04:17 PM
#7
Re: Importing System.dll and so on.
It works in C++ though....
-
Jul 8th, 2005, 06:25 PM
#8
Re: Importing System.dll and so on.
you could make a project file and manually add the dll's to it
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 9th, 2005, 04:23 AM
#9
Re: Importing System.dll and so on.
Yeah...but then Monodevelop won't detect it. And then I could just as well, just compile the single line like this:
mcs -r:System.dll -r:System.Windows.Forms.dll Helloworld.cs
or something like that...
- ØØ -
-
Sep 21st, 2005, 03:22 AM
#10
Re: Importing System.dll and so on.
Looks like I found the solution here. Havn't tested it yet. But should work in most cases.
http://www.codeproject.com/csharp/AddRefVSNET.asp
- ØØ -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|