| 1 | |
| 2 | == MaestroAPI and !MapGuideDotNetApi with !LocalNative connections == |
| 3 | This document describes how to use the !MapGuideDotNetApi with [wiki:maestro MapGuide Maestro] API. |
| 4 | |
| 5 | == Why all the trouble == |
| 6 | The MaestroAPI is signed with a !StrongName key, so you can use it in both strong name signed applications as well as non-signed applications. |
| 7 | |
| 8 | If you use the !LocalNative connection, Maestro uses the !MapGuide binaries to connect to !MapGuide. |
| 9 | Each version of !MapGuide has a new version of the !MapGuideDotNetApi, which is often not signed, and usually |
| 10 | changes version numbers. |
| 11 | |
| 12 | This makes it difficult to use with MaestroAPI, as it is compiled with a reference to a signed !MapGuideDotNetApi. |
| 13 | |
| 14 | == What to do == |
| 15 | To work with another version than the one MaestroAPI was compiled for, you need a signed version of the !MapGuideDotNetApi and a bindingRedirect. |
| 16 | |
| 17 | |
| 18 | == How to obtain the signed version of !MapGuideDotNetApi == |
| 19 | If you are targeting a main release of !MapGuide, there may be a ready made !MapGuideDotNetApi.dll here: |
| 20 | [http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Signer/SignedVersions] |
| 21 | |
| 22 | If you the version you need is not listed, you can sign the one you have, using this commandline: |
| 23 | {{{ |
| 24 | signer.exe -k maestroapi.key -outdir .\out -a MapGuideDotNetApi.dll |
| 25 | }}} |
| 26 | |
| 27 | The maestroapi.key is also avalible from the above link. |
| 28 | |
| 29 | Signer.exe is from the [http://www.codeplex.com/Signer Signer project]. |
| 30 | |
| 31 | If your !MapGuideDotNetApi.dll is already signed, you need to play tricks with Signer, or simply build the dll from the !MapGuide source. |
| 32 | |
| 33 | == How to use bindingRedirect == |
| 34 | As MaestroAPI is compiled with a reference to a certain version of !MapGuideDotNetApi, you cannot just update the dll. |
| 35 | |
| 36 | Microsoft MSDN has a description of [http://msdn.microsoft.com/en-us/library/7wd6ex19%28VS.80%29.aspx the problem and solution]. |
| 37 | |
| 38 | Basically you place a configuration file with the same name as your executable. |
| 39 | For web applications, the file must be named web.config. |
| 40 | Example: |
| 41 | {{{ |
| 42 | MyApplication.exe |
| 43 | MyApplication.exe.configuration |
| 44 | }}} |
| 45 | |
| 46 | There is a sample config file with the [http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Signer/SignedVersions pre-signed dll's] |
| 47 | |
| 48 | You simply add a <bindingRedirect> xml element stating the new version to bind to, eg: |
| 49 | {{{ |
| 50 | <bindingRedirect oldVersion="2.0.0.2308" newVersion="1.0.0.1" /> |
| 51 | }}} |
| 52 | |
| 53 | You can then replace the !MapGuideDotNetApi dll with the one with the new version number. |
| 54 | |
| 55 | An optional step is to also point to the correct file. You must do this is the new file is not named !MapGuideDotNetApi.dll: |
| 56 | {{{ |
| 57 | <codeBase version="1.0.0.1" href="C:\MapGuideDotNetApi-2.1.dll"/> |
| 58 | }}} |
| 59 | |
| 60 | Unfortunately the href path must be absolute. |