When developing a business application for Windows Azure, almost surely you end up creating custom build configurations to manage multiple deployment settings for the different stages of the development process. To do this VS2010 and Windows Azure SDK (from 1.4) offer some straightforward interfaces for the configurations management with an automatic update of the project files.

Unfortunately, in Windows Azure projects with web roles this process can cause some packaging and publishing problems on x86 machines. In fact after the set up of a new custom configuration, you may receive this build warning when creating the Azure deploy package:

warning WAT160: The project ‘YourProject’ contains the following assembly: C:\Windows\assembly\GAC_32\msshrtmi\1.0.0.0__31bf3856ad364e35\msshrtmi.dll. This assembly is not compatible with the 64-bit processor architecture used by IIS on Windows Azure. To make sure that the role starts, you must replace this assembly with one that is compatible with this architecture.

The reason for this warning is that the automatic project files updater creates the new configuration property group in the web project file (.csproj) from a template which includes a PlatformTarget element. The presence of this element forces the inclusion of the msshrtmi.dll, that on x86 machines is only 32-bit processors compatible.

Example configuration tag:

<PropertyGroup Condition=”‘$(Configuration)|$(Platform)’ == ‘Production|AnyCPU’”>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
    <PlatformTarget>AnyCPU</PlatformTarget>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>

When deploying the packaged solution to Windows Azure the Web Roles containing the msshrtmi.dll library will not start properly.

Solution

Fortunately, the solution is quite simple: you should manually remove the PlatformTarget element from all the custom configurations properties in the web project file.

To solve this problem you have to:

  • In Solution Explorer, right-click on your web project and select Unload Project
  • Right click again and select Edit
  • Delete all PlatformTarget elements
  • Close the file and Reload Project by right clicking on the web project
About these ads
Follow

Get every new post delivered to your Inbox.

Join 270 other followers

%d bloggers like this: