Mountain Meadow Medical Records

Compiling Source Code for M

Yes, you can comple the code with Microsoft Visual Studio, or even Microsoft Visual C# Express Edition, by following the following steps

Step by step

Just so you know...This project can compile with the Express Edition of C# except for the Setup project that creates a Microsoft Installer file SetupMM3.msi. Of course you don't need the setup file - it's just to facilitate setting up the program on other computers but not required. Still you will get an alarm that the Setup program could not be loaded every time you load the MountainMeadow3 solution if you are using Express Edition.

Download the code

See the download page for instructions. Typically you will download the code from the SourceForge repository into your local c:\MountainMeadow3 folder. It might work in another folder since we try to use relative paths to file references, but there may be files not found if they are specifically called 'C:\MountainMeadow3\so and so'

Create a database

See the download page for instructions.

Use "run as admin" mode

There are many projects in the M solution that have pre-compile events defined to copy the Eastridges.pfx code signing password from the Keys folder, etc and VS balks at copying files if you are not running as Administrator. It's not enough to be running an Administrator Windows login account, you have to right-click the visual studio file and choose "Run as administrator."

If you don't do this the compiler error messages won't say, "You should run as administrator. " No, they'll say unintuitive stuff like, "MM3 not defined. Are you missing a project reference? " If you look far enough down the list of errors one will say "Pre-build event so and so finished with an exit code of 1" or something which indicates it couldn't copy the file.

You may choose to make a shortcut to Visual Studio and specify in the shortcut's Properties, Advanced that the program should be Run as administrator so it always runs that way.

Make a code-signing key

Almost every project has to be signed with a strongly named key. To facilitate this most projects include pre-build events to copy the file Eastridges.pfx from the MountainMeadow3\Keys folder into their local project folder and they already reference Eastridges.pfx as their signing key. In order to use this you must create a key file called Eastridges WITH A PASSWORD (so that it will be called Eastridges.pfx and not Eastridges.snk) and copy it into the MountainMeadow3\Keys folder.

How to create a signing key: In visual studio, open a project, I suggest the 'CreateEncryptionKeysForMM3' project. (Don't confuse encryption keys with signing key- we're just making a code-signing key right now.)
Right-click CreateEncryptionKeysForMM3 and choose Properties.
On that page click the Signing tab.
Click the drop down box under 'choose a strong named key file.
Click new, give it the name Eastridges and give it a password.
Now go into Windows Explorer and manually copy the Eastridges.pfx file you just created into the MountainMeadow3\Keys folder.

Sometimes that's all you have to do. However, you may still get error messages about Eastridges.pfx after the files are copied if Visual Studio doesn't know the password for Eastridges.pfx. You should be able to just manually sign the MountainMeadow3 project (Delete the local copy of Eastridges.pfx, then browse to the Eastridges.pfx file in the Keys folder, it will ask for a password, you give it) and the other projects will inherit that information from the MountainMeadow3 project.
See more on signing the .pfx file at
For example, sn -i companyname.pfx VS_KEY_3E185446540E7F7A where the container name VS_KEY_blah is given in the error message.

There is an alternative if you don't want to use the Eastridges.pfx method. You may use the sn.exe utility to make a key pair. (see Then sign each project individually using your key pair. In that case you should probably still make a dummy file called Eastridges.pfx because the pre-build events will fail if there is not file to copy from the Keys folder into their folders.

Make Encryption Keys

Encryption keys are used for encrypting private notes, encrypting database backups, and for encrypting the database password inside the MM3License file.

To facilitate this step, open Visual Studio and open and run CreateEncryptionKeysForMM3.

You'll get a warning because it is running in the project's bin\debug folder rather than in MountainMeadow3\Keys. You should click the browse button and browse to the MountainMeadow3\Keys folder so the keys will be written where you want them. Then just click to create the keys.

WARNING: Be sure and keep a copy of these keys in a safe and secure place because you can never make those samme keys again!

Compile them into a keys dll component.

The keys you just made need to be incorporated into a dll component that all the other projects can access to get the keys securely. The project MM3Keys is included in the repository to facilitate this in a simple way. To be secure in a production environment, you will want to make your own MM3Keys project, optionally change its output to MM3Keys_yourname.dll, and run it through an obfuscator program so that it is secure.

For now though, just compile MM3Keys and it will create MM3Keys.dll in the MountainMeadow3\Keys folder (or better yet, go to MM3Keys project properties, Application tab and rename the assembly name to MM3Keys_xxx but leave the default namespace as MM3Keys so the MM3Keys.dll you make won't be mixed up with the one that's already made by EastRidges).

Make a license

The password for the database you want to connect to must be encrypted in a MM3License file. As you might have guessed, the MM3License project is in the repository to do this. It uses the license encryption keys you created and sealed into the mm3 keys dll file above.

Just run the project. Use the browse buttons to designate the name for our license (e.g. MM3License_xxx) and the output location for your lisense (be sure and remember where you located it) and the location and name of the mm3 keys dll file. Fill in the information and click Create File.

Now you can compile MountainMeadow3.

You will need to know the name of your database (e.g. ComputerName\SQLEXPRESS ) and the location of the MM3License file you just created.

If you have already run the program on your computer and want to change the MM3License file, check 'Specify a different server' when logging in, and then [Locate MM3License file].

Keeping in sync with the current version at EastRidges

The code in the repository may be unstable at times so if you are using it in practice, you should only use the most recent version of compiled program at To use it you will need a MM3License key from EastRidges, as described in the Create Your Own Database page. You will also need to check the database update scripts that are in the files you downloaded from the repository and stored at \MountainMeadow3\Database\NumberedScripts. You should apply any numbered scripts (via Tools, Admin Console in the M program) that are due before upgrading to the latest program compile. You can still compile and use your own plugins signed by your code-signing key and plug them into the EastRidges compiled program.