|
I have written 3 class libraries and want to share among different applications. How can I do that?
Thanks
|
|
|
|
|
In the Solution Explorer, right-click on the "References" folder and select "Add Reference...". On the .NET tab, click the "Browse..." button and locate your class libraries' *.dll files and add them as needed. From there, they are part of your project and ready for use.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
um.. i mean how can i use the same dll in different applications? i don't want my device to have multiple copies of the dll
thanks
|
|
|
|
|
Install the assembly into the Global Assembly Cache (GAC). You can do this using gacutil.exe that ships with the .NET Framework (the runtime, not the SDK, so every machine with .NET installed will have it), or a Windows Installer project.
When developing the application, you must still reference the DLL when building (and I recommend a Project reference as opposed to a file reference if these projects are in the same solution - just select the Projects tab when adding a reference). When you run the application, however, if the assembly name is found in the GAC (where the CLR first looks) it will use that copy. Otherwise the CLR reverts to a local copy or a location defined in the app's .config file.
To install into the GAC, your assembly must be strong named, which means it must be signed (always a good idea anyway).
To generate a key pair, use:
sn.exe -k KeyFile.snk Use the path to that file in the [assembly: AssemblyKeyFileAttribute[ you typically find in your projects' AssemblyInfo.cs files. I recommend using the same one for all your assemblies, or at least for a particular project.
You should also disable automatic versioning of the shared assembly by getting rid of the asterisk (*) in the [assembly: AssemblyVersionAttribute] (also commonly found in the AssemblyInfo.cs file, though they can go anywhere). If you use automatic versioning, you'll need to install a new copy into the GAC with every change. Instead, just managed the version numbers yourself for much better control.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
To add to what Heath said...
You should have all of the shared DLL's in a single directory. For example, if every developer gets a network shared drive that is a G: drive, then I'd put them in the G:\Shared Utils directory.
Once you get them added to the GAC, then you need to create a single registry key entry:
HKLM/Software/Microsoft/.NetFramework/AssemblyFolders/{companyname}SharedFolder
Then set this key to the value G:/Shared Utils
This is required if you want your shared dll's to show up in the Add Reference dialog under the .NET dll's.
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
want find a class which can analyse HTTP.
i have the HTTP string,
HTTP 1.0
Connection: keep-alive
Browser: IE40
........
i want input the HTTP string and the class can out put anything i need.
such as
System.Web.HttpRequest
is very good.
but i can't find any mother can input string, what class should i use?
|
|
|
|
|
What???
You can use the System.Net.HttpWebRequest and System.Net.HttpWebResponse and get this information using properties like the Headers dictionary property that each class has, such as:
string someHeader = response.Headers["SomeHeader"]; Many HTTP headers has specific properties, like the ContentType . Read over the documentation for the HttpWebRequest and HttpWebResponse class - part of the pluggable protocol implementation - in the .NET Framework SDK.
Class in System.Web.* namespaces are for ASP.NET and should not be used outside of ASP.NET except in uncommon cases and when you know that they can work (unliked the class you mentioned) outside ASP.NET.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i have seen the MSDN.
but it told me.
don't create HttpWebResponse directly,you should get it from HttpWebRequest.GetResponse.
but i don't have any HttpWebRequest.i only kown the HTTP string
GET /?forumid=1649&fr=51 HTTP/1.1<br />
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, *
i want use an analyser to get the HTTP heads and Params. i want input HTTP string and the analyser can give me anything i want,just like System.Web.HttpRequest.
|
|
|
|
|
Then just do simple line parsing? Use a StringReader and loop through the lines. Split the line on the first colon found:
StringDictionary lookup = new StringDictionary();
using (StringReader reader = new StringReader(httpString))
{
string methodAndRequest = reader.ReadLine();
if (methodAndRequest != null)
{
line = reader.ReadLine();
while (line != null)
{
if (line == "\r\n") break;
string[] header = line.Split(new char[] {':'}, 1);
if (header.Length == 2)
lookup.Add(header[0].Trim(), header[1].Trim());
}
}
}
Console.WriteLine(lookup["Host"]); It's a simple parsing algorithm. If you want, you could further break-down known headers to typed classes or whatever you want to do.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
My simple question is, how do I controle wich user controle is drawn atop and wich is below, whenever these are placed in the same area?
I would like to tell one of the controles to stay on top, and the other to go belov, like a Z index.
Regards
Janus
|
|
|
|
|
The last two buttons (by default) on the Layout tool in Visual Studio.NET deal with control layering. Hope this helps.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
To do this programmatically call either BringToFront or SendToBack method which are inherited from the Control class.
www.troschuetz.de
|
|
|
|
|
Thank you very much
So simple
|
|
|
|
|
As a sitenote I can just tell you all that you have to call these methods, after you add your controls to your form/panel and so on.
Like this:
this.Controls.Add(line1);
line1.BringToFront();
And NOT:
line1.BringToFront();
this.Controls.Add(line1);
Dont know why, but I found out the hard way
Thank you again, for your quick answer ;o)
|
|
|
|
|
When you add your line1-control to the collection of controls, the z-order is updated with the line1-control added to the back, so that the previously called BringToFront method has no effect.
www.troschuetz.de
|
|
|
|
|
How can I set DataGrid row properties depending on its contents (i.e. if the value in column 3 is equal to "Mike" then set the full row background to yellow, if it is equal to "Bob" set the background to cyan, and so on) ?
Thank you for your help.
Maurizio Poggi
|
|
|
|
|
|
I want to get Email Address from WAB ,but I dont't konw how to do . If someone know it ,please help me. I am waiting on line.
|
|
|
|
|
It's not very simple at all. There are articles out there (did you try googling?), though not many using .NET languages like C#.
Look through the MSDN Online Library[^] for the IAddrBook interface. You'll have to re-declare these interfaces in managed code because the typelib importer won't be able to. You'll also have to P/Invoke all the related functions also listed in the documentation under Widnows Address Book[^] in the Web Development section.
Make sure you have a good working knowledge of unmanaged types vs. managed types, like that an unmanaged long is actually a managed int (Int32 ). It also helps to understand COM interop in .NET. Read the section Interoperating with Unmanaged Code[^] in the .NET Framework SDK for more information about both P/Invoke and COM interop.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am using word 10.0 object library for the printing of the creation of a word document ( with office 2002) it works fine on windows xp but when i deploy the same application on windows 2003 server it doesn't work.
The following Error is generated
" Message Filter Application is Busy";
Can anyone help in this regard
|
|
|
|
|
many anti-virus softwares have they own virus database for scaning.
also i want to build my own database for scaning.
But i dont know how to build one.
and how to search items quickly in the database?
|
|
|
|
|
hi,
You can build your own database using datset object. Create a table and clolumns as you require and then populate the dataset as and when required with the necessary data.
You can persist the dataset as an XML file and reinitialize it by reading from XML file.
In dataset it is possible to run a "select" query and retrieve the data like anyother databases.
If your database is simple name-value collection then you might think of using or extending HashTable class...
Hope this answers your query.
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
What Aryadip suggested is hardly quick, depending on the volume you expect to fill your data structure. A virus definitions database, for example, would be far too much for a local DataSet .
Designing your own database requires a good working knowledge of data structures. I suggest you get a good book from Amazon or a university near you about data structures, or take a class if possible. This is well beyond the scope of this or any forum, since some knowledge is required.
There are file-based alternatives out there that would be quicker. The Jet Database (aka - though incorrectly - as Access databases) provides a file-based relational database management system (RDBMS) where you can use ADO.NET. Using an MDB doesn't require that you have Access installed (though it's handy to design the empty database). Access is just an application that uses Jet databases.
There's several other file-based databases as well - just http://www.google.com[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hello
i need help in converting the serial date in Excel into a proper datetime format to be shown in the ListView(in C#)
basically i've imported all the field from an excel worksheet and tabulated into a listview component in C#.
besides i've just read an article about the conversion of Excel datetime into readable format, but i still dont understand the concept of the code.
could anyone out there can guide how to do it?
thank you
|
|
|
|
|
If you have a serial number, simply create a new DateTime starting from 1/1/1900 00:00:00 and add days like so:
DateTime base = DateTime.Parse("1.1.1900");
DateTime fromExcel = base.AddDays(serial); If you want to convert from an OLE Automation date/time (which excel uses), you can use DateTime.FromOADate . Read the .NET Framework SDK documentation for the DateTime structure and its members for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|