Re: Sharing Code
From: Peter Foot [MVP] (feedback_at_nospam-inthehand.com)
Date: 02/07/05
- Next message: Alex Feinman [MVP]: "Re: Pocket PC support for WMI"
- Previous message: news.austin.rr.com: "Re: circular references"
- In reply to: Rafael Sancho: "Re: Sharing Code"
- Next in thread: Rafael Sancho: "Re: Sharing Code"
- Reply: Rafael Sancho: "Re: Sharing Code"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Feb 2005 23:04:21 -0000
I have come across what I think is the same error when referencing a device
dll project from a desktop visual basic exe project (they weren't in the
same solution).
What I found would happen is that when the device dll was built visual
studio would copy a number of compact framework assemblies into the debug or
release folder along with the dll (usually Microsoft.WindowsCE.Forms.dll and
System.Windows.Forms.dll).
In the desktop project when you add a reference to the dll, it sees these
additional dlls and sets the path up as a default reference path for the
desktop project. This means your link to System.Windows.Forms.dll now
incorrectly points to the device version. This explains the reference to AGL
because this is a namespace within the compact framework
System.Windows.Forms assembly - which has a drastically different
architecture from the desktop version.
What cured it for me was to go into the project properties for the desktop
application, manually remove the reference path, and delete the
System.Windows.Forms.dll from the output folder of the device dll project.
However occasionally it still decides to automatically change it back for me
:-(
Peter
-- Peter Foot Windows Embedded MVP www.inthehand.com | www.opennetcf.org "Rafael Sancho" <RafaelSancho@discussions.microsoft.com> wrote in message news:B5F80B66-F966-45E8-BE4A-F2A08CE1C208@microsoft.com... > I'm not sure if you understand my problem. I've created 2 diferent form > projects, one smart device and one desktop, but they're in the same > Solution. In this solution are another 2 srmart device projects (class > library projects). > > The 2 form projects have references to this class library projects. If I > select the smart device form project as start up project I have no > problem, > but if I select the desktop project as startup project, after I build the > solution, the forms do not open anymore (the message I wrote before > appears). > I've read the page you've said before I started, that's why I've created 2 > diferent form projects. > > I've tryed to create 2 diferent solutions (one all Smart Device and one > with > desktop forms ans sharing the code), but when I add the files to the > desktop > solution a copy of the files is created in the solution folder, and if I > change one of the files in the smart device solution the changes do not > appear in the desktop solution. > > Am I doing something wrong? > > Thans for your attention, > > Rafael Sancho > > > "Daniel Moth" wrote: > >> You can share code with compilation constants but that doesn't work well >> with forms (because the code is autogenerated for you and the resource >> files >> are incompatible). Personally, I have different forms for the two >> platforms >> and share the rest of the non-UI code. For some cases where the UI is >> identical, you can design it in the Smart Device Project but *do not* >> open >> the form in the desktop project. >> >> For your specific problem, "show all files" in solution explorer, and >> delete >> the resx file under the problematic form. >> >> For more on sharing code between platforms read this: >> http://www.danielmoth.com/Blog/2004/09/share-code-if-fullframe_17.html >> >> Cheers >> Daniel >> -- >> http://www.danielmoth.com/Blog/ >> >> >> "Rafael Sancho" <Rafael Sancho@discussions.microsoft.com> wrote in >> message >> news:0144E8C3-4079-43A8-91C5-F8D3B2B7BF68@microsoft.com... >> > Hi, >> > >> > I'm trying to share code between a WCE application and a W32 >> > application. >> > I've created a Solution and created 4 projects (one Windows app, one >> > Smart >> > Device App - Selected as an Windows App, two Smart Device App - >> > Selected >> > as >> > Class Library). >> > >> > I've developed all the WCE app without problem, but when I tryed to >> > develop >> > the W32 app, I have problems after compiling the first time. The forms >> > do >> > not >> > open, and the following error apear: >> > >> > "An error occurred while loading the document. Fix the error, and try >> > loading the document again. The error message follows: >> > >> > An exception occurred while trying to create an instance of >> > System.Windows.Forms.Form. The exception was 'Unable to load DLL >> > (AGL)'". >> > >> > I've read some stuff about sharing code, but any of them describes this >> > problem. Does anyone knows what is this error and how to solve it? Am I >> > doing >> > something wrong? >> > >> > Thanks in advance. >> >>
- Next message: Alex Feinman [MVP]: "Re: Pocket PC support for WMI"
- Previous message: news.austin.rr.com: "Re: circular references"
- In reply to: Rafael Sancho: "Re: Sharing Code"
- Next in thread: Rafael Sancho: "Re: Sharing Code"
- Reply: Rafael Sancho: "Re: Sharing Code"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|