|
First, you should use project references instead of assembly references when you have multiple projects in a solution. This ensures that dependencies are created and that the right versions of assemblies are used.
Second, don't use a version number like 1.0.*, the default for the AssemblyVersionAttribute . In larger development projects, this will burn you fast.
Finally, see the <assemblyBinding> section in the .NET Framework SDK - which you can use to redirect versions, as well as publisher policy assemblies - as well as How the Runtime Locates Assemblies[^]. This allows you to redirect assembly version and to know where exactly to put the assemblies, such as in the same directory together, in the GAC, use a custom private path (ex: ASP.NET uses "bin" as its private path), or using the <assemblyBinding> section to specify the codebase for assemblies you want to use no matter where they are.
You should also consider keeping a build directory when you have projects that don't reference other projects, such as a plugin-driven application. With VS.NET, you can do this easily using post-build actions in the project configuration. There's also the DEVPATH environment variable that's documented in the .NET Framework SDK that can be helpful as well. It pretty much works like the PATH environment variable used to locate executables (.exes, .dlls, .bats, etc.).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey thanks!
We have lookt throw the MSDN on this topic, but cant realy find what to do.
We dont understand what Asembling file is for? we think it haveing the information about what dll version is used and where to find it. But we cant find a file in our project that have this information.
We have added dll files to our Windows control Libararys this way.
move the dll file to /bin/debug
rightclick on the referens and added the dll file to the project. This works fine and we can worke against the dll file with no problem.
But when we then add all Windows control Librarys to the main project we get some dll varnings, and as a said the versions on some dll files is changed to older versions.
Pleas could you maby do a stepBYstep on this?
//Jimmy
|
|
|
|
|
I already told you how to solve this: use project references, not assembly references, and do NOT use automatic versioning because you easily loose track of what versions of assemblies you're binding to.
If you don't know what an assembly is, you should pick up a book or two on .NET development. It's a basic unit of a .NET application. It contains the code in modules (which are more like native DLLs), resources, assembly attributes, and a manifest that lists them all.
When you compile an assembly, the versions of dependent assemblies are compiled into the assembly, so if you compile against version 1.0.0.0 of an assembly, then that version of the assembly has to be found, otherwise you have to use the <assemblyBinding> section of your app.config file, or use a publisher policy assembly, both of which can redirect the versions. This is meant primarily for upgrading applications without having to upgrade every existing assembly.
Also, don't add references to the bin/debug or bin/release directorys. Use project references primarily. If you're using a third-party control, it should install on the local filesystem and into the GAC. Don't change this. References are copied to the project target directory (bin/debug, bin/release, etc.) when you compile (by default, those in the GAC do not). That's why you don't include your dependent assemblies in the target directories. If you use project referneces like I've mentioned several times now, build dependencies are setup and the assemblies are copied to the target directory keeping the versions in sync.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is it possible to read, write, and perform drive maintenance(cleaning, inventory, etc.) on a tape drive from C#? Thanks alot
|
|
|
|
|
Is it possible? Sure. Would anyone sane want to do it? Absolutely not. Tape drive access is a very low-level, huge set of operations. You'll need to P/Invoke so many functions and declare so many structs and consts/enums that you'll probably never get to the meat of the development, unless you can find some COM control to interop or a wrapper DLL that you can P/Invoke, but you probably won't since this is not something that consumers typically "play with". The software you use with your drive (Veritas Backup, et. al.) may have some undocumented APIs you could P/Invoke, but as they're most likely undocumented for a reason you'll have a REALLY tough time.
See the Windows DDK (driver development kit) for details. It's huge and it's ugly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have an object of type UserControl that I occasionally have problems with.
Normally, when I move the mouse over the object, windows will generate a mouse move event as advertized - only when the mouse moves.
Occasionally, however, windows goes crazy on me and generates a gazillion mouse move events for as long as the mouse is over the object and it is not even moving. I get so many of these events that it inhibits the application from performing until I move the mouse off the object.
Has anyone seen this type of behavior before and, if so, was there anything you could do about it?
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
You are probably doing a wrong invalidate during the event handling, I have seen the same behaviour on the PropertyGrids TypeConvertors.
top secret
|
|
|
|
|
Yup - I've experienced it. It was an OpenGL control with mouse interaction, and didn't bother to work out WHY it happened - I just stopped it being a pain with following pseudocode:
PointOrWhatever savedPosition;
void HandleMouseEvent(whatever args)
{
if(args.position == savedPosition)
return;
DoMyMouseMovingStuff();
savedPosition = args.position;
}
Regards
Brewman
|
|
|
|
|
I'm wondering if the codeproject guru's might have an answer to my little riddle. I have plenty of code to call the createprocess function of the coredll.Dll assembly. Here is my quandry, all of those api declerations along with the actual call itself use a part of the framework that is not included with the compact framework. For instance I know you can use the Process class to create process's, but not with the cf. I have some code that defines the function but defines various parameters through the System.Web namespace, also not included with the cf. Ill post my decleration, any help would be appreciated.
[DllImport("CoreDll.DLL", SetLastError=true)]
private extern static int CreateProcess(String imageName, String cmdLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes,Int32 bool InheritHandles, Int32 dwCreationFlags,IntPtr lpEnvironment,
IntPtr lpszCurrentDir,byte [] si, ProcessInfo pi );
Thanks again,
Ryan
|
|
|
|
|
Sorry, but I'm not really seeing a relevent problem statement there. Are you saying your P/Invoke declaration isn't working? And what do you mean you're defining various parameters through the System.Web namespace?
Your declaration look okay to me. You might want to add CharSet=CharSet.Unicode to your DllImportAttribute to be sure that strings are marshalled appropriately.
If you don't like calling this often from your code, encapsulate it in a public static method or something.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I apoligize for not being more clear. I can't use the statement because the ProcessInfo class which is the last argument is part of the System.Web namespace which isnt included in the cf. I was curious if anyone knew of another way of declaring the function without using the ProcessInfo class for the last argument.
Thanks,
Ryan
|
|
|
|
|
Just call the parameter as something else. The fact is that you have to define that struct that the P/Invoke statement takes. You could call it Asdf and it won't matter, so long as the struct matches the structure defined in Windows. If you like the name ProcessInfo , then define it yourself and just qualify it with the namespace you define it under.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
For future reference I was able to just use IntPtr.Zero for the parameter, thanks again Heath.
Ryan
|
|
|
|
|
Can anyone help me in plotting on a map using latitudes and longitudes. Am doing a project in using GPS.
The methods i used doesn't give enough accuracy.
Can anyone give suggestions to improve accuracy.
sibish
|
|
|
|
|
Define 'accuracy' and 'plot'. What method did you use? What is its purpose?
I have experience of plotting lat/long country outlines and GPS data onto a computer screen. Treat the lat/long as a coordinate in 3D space (polar coords with constant Radius - or is this the inaccuracy you talk about? Do you want a more accurate geoid(earth-shape)?). Convert to Cartesian coords (X, Y, Z) Then project onto a 2D surface. Which projection do you want to use? There are hundreds, but probably less than a dozen that cover 99% of needs. Each projection has its own strengths and weaknesses (read: inaccuracies). e.g. a Mercator allows sailors (& others) to travel at a constant bearing to reach their destination, but distorts shapes.
To allow 'autosizing' of the display, I just used the min/max lat/long rectangle diagonal & scaled it - fine unless you're working near the poles (I was using Europe, US & Canada - Canada was almost a problem!).
Give more specific details of what you're doing & want to achieve, and you could receive more specific help.
Regards
Brewman
|
|
|
|
|
Dear Sir,
i have already write an application for that issue, first of all you have to calibrate the map by putting thin point on it, by this way you can relate the coordinates oof the map with the UTM coordinates
by this control points you will get an accurate tracking, the tracking error will be not more that 2-3 meters if you have any other Q you can ask me
Regards
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Hi,
Can you send me your application source code.Send to sibbsnb@yahoo.com
Thank you
sibish
|
|
|
|
|
Dear Sir,
Exuse me sir it is top secure code i could not send it to you gut if you have any quistion you can ask me
Regards
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
If you're plotting simple Lat/Long as X/Y (or is that Y/X?) and your Long is too short(?!) on the map (i.e. if you 'walk' in a square and an oblong appears) ...
then if:
- area is small (less than say 100 miles/kilometres)
- not a polar region
then let LonAdj = Lon/cos(LatOfMapMidPoint) and plot that.
If a polar region, plot as polar (radius = 90-abs(Lat) & theta/angle = Long * sign(Lat))
Regards
Brewman
|
|
|
|
|
Hey
I have now used Double buffering to the background picture of a 1024*712 form, it simes like it is much smother, but still i could notice some lag when moving the form around.
1. Now i will place some System Controls(own made controls) in this form, do i have to use the double buffert inside this controllers to? or do the form(with double buffert) fix double buffert to al the controls?
2. this controls haves som grafic, like buttons and so on, not to big with other words.
shold i draw this images on the buttons and so on in the OnPaint override or is it okay to just load them direct in to the buttons(maby not to big difrrence, when thay isent that big?).
3. What picture format is less expensive to handle? png, jpeg, bmp, gif...
and what quality? maby no compression at al is bether then compressed?
//Jimmy
|
|
|
|
|
Are they system controls, or your controls? In #1, that isn't clear. You typically don't need to modify system controls because most aren't drawn at all by .NET. Windows Forms controls encapsulate their Common Control equivalents which draw themselves using GDI outside the realm of .NET. Ever wonder how Microsoft keeps the Win32 controls and the .NET controls looking the same? Because they are the same.
Bitmaps (bmp) are the best way to go. These are used primarily throughout much of the code that makes up Windows, Office, Photoshop, and most other programs you can think of. Up until a few years ago when more and more applications started using bits of the Internet Explorer WebBrowser control and MSHTML, that's all that was supported without your own rendering. Bitmaps are uncompressed (well, some may be RLE compressed but this is rare when dealing with Windows graphics), where the others are compressed and, in the case of a GIF, indexed.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
When i wrote System controls, then i ment Windows Control Library(my bad). this controls is then applayed to my form.
in the Windows Control Library i adds buttons and listboxens and so on, and in many cases there will be grafik applayed to this contrlls like buttons and listboxes. This pictures is not big, but maby i have to draw then my self in the onpiant to get an overal bether preformans of my application?
And will i have to use Double bufferting(SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true);) on this Windows control Library to get them to use double buffering.
if have got this right?
double buffering (SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true);)
is used to first load the picture in to the memory and then display it, and when it is repainted its repainted in the memory first and then displayed?
And to override the OnPaint and draw some of the pictures myself is another way to get bether preformans, but i can use only the buffering or only the overridden onpiant, thay have not realy a connection ??
Thankt alot with the fast answare
//Jimmy
|
|
|
|
|
Yes, that's how you enable double-buffering and that's how it works. It draws the on-screen bitmap in memory and then pushes it to the device context.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Okay, good, Tanks!
But do i have to use the double bufferting in the Windows Library controls that i make? or will the main form(project)s doubel buffering configuration applay to the controls that are applayed to the form?
//Jimmy
|
|
|
|
|