Sunday, March 18, 2012

Creating single EXE that depends on many DLL files in C# using visual studio

Many applications consist of an EXE that depends on many DLL files. When deploying an application all files must be deployed. So carrying all dependent DLL files for an exe during deployment is a problem and you may miss one of the dependent DLL file. To overcome on this problem you can create a single deployable EXE in Visual Studio. In visual studio, we can make configuration of EXE in such a way that, we can load an assembly at runtime that is located in a folder that is not the bin folder of the application. You do not have to put an assembly that an application must use at runtime in the bin folder of the application. You can put the assembly in any folder on the system, and then you can refer to the assembly at runtime. Following procedure explain the same –
The technique uses Appdomain’s “AssemblyResolve” event to achieve it. First, identify all the DLL files that your EXE file depends on. Then add these DLL files in one of the folder in your project. For example, I am using following DLL files in my application which I have added in dll folder in my application –  

Friday, March 9, 2012

Using Windows Azure Access Control Services for Windows Live Authentication using Live Id SDK – Part 2

Ok, in part 1, we saw how ADFS authentication gives us profile information in the forms of claims which we don’t receive in case of using Live ID authentication.
To receive profile information we need to use Windows Live SDK. First we need to create an application on Live ID connect API’s portal. Browse to the following link,, login with your Live ID credentials and then create an application as shown below –
Click on Create Application link. Then provide application name [samplewebrole in my case] and language as English. Then under API settings specify, redirect URL.

This is the URL to which access token will be sent by Live ID. Then we will use this access token to receive profile information in Callback.aspx. Here in Redirect URL I am specifying the URL which will be online when application will be deployed to cloud. You can specify any other URL like – or anything of your choice.

Using Windows Azure Access Control Services for Windows Live Authentication using Live Id SDK and ADFS authentication – Part 1

After long time I am writing post today. Well I was busy in doing some important work related to Azure which took substantial amount of time. Today I am going to discuss the same.
I will guide you on how I used Azure ACS along with Windows Live ID. The main problem with Windows Live Id using with Azure ACS is that, you don’t get profile information. Means you will not receive the email ID, user name etc information as claims from Azure ACS when using Live Id. So what is the solution?
Also I want to use ADFS (Active Directory Federation Service) for which I need to use ACS. So how can I integrate Access Control Services with Active Directory Federation Services and Live ID and get required information in claims? Following post talks about the same.

Here I assume that, you already have an ACS namespace configured on Azure Management Portal. Also you have configured Identity Providers – ADFS and Live ID, relying party for URL – along with necessary rules. For example “name” rule for live ID and default rules that get generated for my ADFS. If local cloud environment is running on port 81 then relying party URL will be – I am running on port 80 so throughout the explanation I will use only.

Windows Azure ACS - Windows Live Integration - Callback.aspx code samples

This post is follow up of Part 1 and Part 2.
Callback.aspx -

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Avanade.AMMO.Web.Callback" Codebehind="Callback.aspx.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <script src="//" type="text/javascript" language="javascript"></script>
<form id="form2" runat="server">