Opened 12 years ago

Closed 12 years ago

#2102 closed task (fixed)

MgDesktopSample can't run

Reported by: bassonsh Owned by: jng
Priority: medium Milestone: 2.4
Component: Desktop API Version: 2.4.0
Severity: minor Keywords: MgRenderingService could not be found
Cc: External ID:

Description

Hi,

I've downloaded the MgDesktopSample source code and i'm trying to compile it on my PC but get some error saying that the 'MgRenderingService' could not be found.

I've got some basic programming knowledge, i've followed the instructions in the readme.txt file that comes with the source code (changed the referenced assemblies to point to my mg-desktop location and update the post build command) and i still get these errors.

I'm using visual studio 2010, i downloaded all 32bit files for this exercise and i'm working on a 64bit machine.

I'm trying to play around with some code to edit the viewer (sample code) in such a way that i can just open any .mgp file and not just the default test package.

I've attached a Word document to show the files that i downloaded for this and it also has a screenshot with the error. Any help would be greatly appreciated! Thank you very much.

Regards, Shaun

Attachments (4)

Error1.docx (128.1 KB ) - added by bassonsh 12 years ago.
MgDesktopSample Compilation Error
Error2.docx (36.1 KB ) - added by bassonsh 12 years ago.
Error3.docx (55.0 KB ) - added by bassonsh 12 years ago.
Error4.docx (182.4 KB ) - added by bassonsh 12 years ago.

Download all attachments as: .zip

Change History (13)

by bassonsh, 12 years ago

Attachment: Error1.docx added

MgDesktopSample Compilation Error

comment:1 by jng, 12 years ago

Component: GeneralDesktop API
Owner: set to jng

comment:2 by jng, 12 years ago

All mg-desktop classes that derive from classes in the MapGuide core now use a "Mgd" prefix instead of "Mg", so:

I'll update the sample soon to reflect this.

by bassonsh, 12 years ago

Attachment: Error2.docx added

comment:3 by bassonsh, 12 years ago

Thanks,

I've tried that based on the classes being used in the previous lines on that page, but then the next line (see attached) is problematic as the MgDesktopMapViewerProvider class only takes one argument (map), which would then make the MgdRenderingService instance obsolete?

Regards, Shaun

comment:4 by jng, 12 years ago

Yeah, more API changes there (these changes are documented, it's just all over the place atm)

Basically the ctor of MgDesktopMapViewerProvider doesn't need resource and rendering service objects passed to it anymore. It has enough knowledge to create these services itself, so you only need to just pass the MgdMap.

by bassonsh, 12 years ago

Attachment: Error3.docx added

comment:5 by bassonsh, 12 years ago

I see, thanks. Thant would make sense. My project build succeeded now after fixing up that piece of code, but when i run, i get the error below:

Could not load file or assembly 'OSGeo.MapGuide.Desktop, Version=2.4.0.6914, Culture=neutral, PublicKeyToken=e75f9fd7cf82dc3f' or one of its dependencies. The system cannot find the file specified.

Is this just a case of version incompatibilities? I did fix the reference to that assembly with no errors. I took a screenshot of the properties of that assembly (attached).

Thank you. Regards, Shaun

comment:6 by jng, 12 years ago

Probably something wrong with the post-build. Basically VS should be compiling your sample application out to the same directory that the post-build step copied the mg-desktop files into.

I'm seriously considering making a NuGet package for the next binary drop of mg-desktop. It'll make this kind of initial setup so much easier.

comment:7 by bassonsh, 12 years ago

Yes i see that it VS does copy the DLL files from my mg-desktop folder to the bin\debug folder but it doesnt copy anything to the folder specified in the post-build command. This is so frustrating!

Is there maybe something obvious that's wrong with my post build command? (maybe with the switches?):

xcopy /S /Y /I "E:\..\bin\release\*.*"

Something else i noticed is that when i now compile the example, i still get the error i described last:

Could not load file or assembly 'OSGeo.MapGuide.Desktop, Version=2.4.0.6914, Culture=neutral, PublicKeyToken?=e75f9fd7cf82dc3f' or one of its dependencies. The system cannot find the file specified.

But the last sentence has changed to:

...one of its dependencies. An attempt was made to load a program with an incorrect format.

Dont know if thats any different. Is there no workaround to just get this sample to compile? Thanks for all your help.

comment:8 by bassonsh, 12 years ago

Ok just a bit of an update on my progress:

With the help of some forums, i manage to solve the last error i reported by switching the platform target in VS to x86. It kind of makes sense since i'm working with 32bit code on a 64bit machine. Now my code stops when i want to debug right in the beginning where it want to initialize the Platform.ini file. When i go down all the way the inner exception gives the following message:

Unable to load DLL 'MapGuideDesktopUnmanagedApi': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

What i dont get is that the DLL is present in my referenced mg-desktop folder and i also cant add it as a reference. All errors are in the attached file (Error4). Any ideas?

Thanks. Shaun

by bassonsh, 12 years ago

Attachment: Error4.docx added

comment:9 by jng, 12 years ago

Resolution: fixed
Status: newclosed

Use the latest release of mg-desktop that I've uploaded. The updated/fixed samples are included in the zip file.

You have my details so ping me if there's any other problems/questions

Note: See TracTickets for help on using tickets.