Msshrtmi.dll is a nasty little assembly that ships as part of the Azure SDK and is required as a dependency of ServiceRuntime to determine if you are running in or outside of Azure.
The problem lies in the fact that the assembly is unmanaged, and ships with different DLLs for x86 and x64. This causes all kinds of havoc as you need to build your projects with different target architectures depending upon context. As an example, IISExpress only runs in 32-bit mode.
Note: some of this pain is self-inflicted, as I absolutely refuse to install things into the GAC of my build server. This is a different post.
In order to remove this dependency, you need to find a different way of determining if you’re on Azure. We found the simplest way was to add an environment variable that was set as an Azure start-up task. We then look for this variable when constructing our RoleEnvironment adapter.
Add a batch file such as this to your project and set to copy always.
setx INAZURE True /M
Add the following element to the top of each WorkerRole element in your csdef files.
<Startup> <Task commandLine="SetEnvVar.cmd" executionContext="elevated" taskType="simple" /> </Startup>
Update: Check out http://github.com/awithy/AzureCmdLetDeployment for a working example project.