Monday, April 11, 2011

Windows Azure - Referring DLL from GAC

Hi All,
Many times you may face requirement that, you are developing a web application and you want to host web application as a web role in Azure. While development lets say that, you have used your application specific DLL's which you added in GAC - Global assembly cache and referencing from there.

So while hosting web role on Azure, how can you make sure that, your required DLL gets added to GAC before role starts?

Following steps wil explain you the same.

Add a folder in solution explorer by right clicking on project and selecting option of "New Folder".

Add GACUtil.exe and associated configuration file gacutil.exe.config to this folder. You may find the GAC exe at location "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64".

Add your DLL also to same folder.

Add a .cmd file to same folder and write code as follows - (REM stands for comment in cmd file)

Then go to properties of each file added above and select "Copy Always" option against "copy to output directory" option.
Under "serviceDefinition.csdef" file as following line under web role tag - <Startup>
<Task commandLine=".\MyfolderName\RegisterGAC.cmd" executionContext="elevated" taskType="simple" />
</Startup>

Followers

About Me

I am Kunal Chandratre. Working as Cloud Solution Architect @Microsoft. My speciality is Microsoft Azure Cloud platform.
Awarded as Most Valuable Professional (MVP) in Microsoft Azure for consecutive 3 years. Passionate speaker, trainer...In free time (which I don't get usually)I write blogs and answers the forum questions. I was doing it just for timespass but now I have got addicted to blogging...Apart from work, I do variety of things which I can't tell here:).. I am trekker, singer, actor, painter, f1 racer, super hero in my dreams.. ...and now trying my luck with technologies...Keep posting...

Visitors

Disclaimer:

The information shared in this blog is the result of my personal experience with various technology platforms. In no way it represents the company I work for.
The information provided here is "AS IS" with no warranties, and confers no rights. This blog does not represent the thoughts, intentions, plans or strategies of my current employer or past empolyers or any other forums or community I belong to. It is fully my own opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.I have full rights to edit/modify/delete any content of this blog without any prior notice to public/followers/RSS readers of this blog.