Philippe Truche’s Blog

2 March 2007

Installing a Smart Client Software Factory client application

Filed under: .NET — Philippe Truche @ 7:28

I’ve been working on a Smart Client Software Factory development effort, and as we were nearing the end of the development, I spent some time looking at how I would deploy the client application to end users.  Though I was initially attracted to ClickOnce deployment because of the automatic update feature, I shied away from this and ended up crafting an MSI installer.  Having tinkered with both technologies, I now understand better when ClickOnce and MSIs are appropriate.  In my opinion, ClickOnce should be used only if MSIs cannot be used.  I find MSIs provide much more control over the installation process, and from my experience, are somewhat easier to put together when your application is architected around the Composite UI Application Block. 

 This being said, the installer has to be able to handle the following requirements:

  •  The same MSI should be used for development, testing, and production.  This helps to ensure that the same code base is used throughout all environments.
  • The installer should be able to encrypt app.config sections during the installation.
  • You should be able to debug into the installer during development.

Now, before I move into the meat of the installer program and the setup project, let’s talk about app.config files and the web references in Visual Studio 2005.  When you add a web reference, Visual Studio 2005 performs a number of steps to make it easy to change the web service Url without re-compiling code.   One of those steps is to create entries in the app.config file of the project.  If the project does not contain an app.config, Visual Studio will create one for you.  So what happens to the app.config when the library project get compiled?  Well, you end up with a [AssemblyName].dll.config.  So your application directory may contain one exe, one exe.config, and nothing else.  You might be tempted to copy the dll.config files into the application directory, but that will not achieve the desired result: you want the application to obtain its web service Urls from configuration so you can make changes between environments easily.  So here is the trick:

Open the app.config file(s) from the library project(s) and copy the <section name=YourProjectName.Properties.Settings child element of <sectionGroup name=applicationSettings“…> into the same place in the app.config file of the Windows Forms project.  Then, copy the entire content of the <applicationSettings> section from the library project’s app.config into the Windows Forms app.config file, taking care not to replace its contents but add to it.  As a result, the app.config of the Windows Forms project will look like this:



<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" >     

<section name="YourExeProject.Properties.Settings"… />

<section name="YourLibraryProject1.Infrastructure.Library.Properties.Settings"…/>

<section name=" YourLibraryProject2.Properties.Settings"…/>





<setting name="Timeout" serializeAs="String">





<setting name="Service1" serializeAs="String">





<setting name="Service2" serializeAs="String">







I’ll get into
the code that satisfies the installer requirements on my next post.



  1. hello, i think i’m with the same issue, we are working with the Smart Client Software Factory and by the moment we’re working with clicOnce, but we have to do the app.config encryption, i don’t know if it’s possible to do this with clicOnce. Is there a alternative way to use clicOnce along with the configuration file’s encryption?.

    Another issue, there’s no way to encrypt the config file when using the Enterprise Library, that’s why the configSections section is not recognized when attepting to encrypt the file.

    any suggestion?


    Comment by rodrigo — 24 March 2007 @ 9:48

  2. Rodrigo,

    If you’re going to use ClickOnce, you’ll have to encrypt the *.exe.config file when users first start the application. It’s not ideal, but I am afraid there is no other choice. Also keep in mind that with ClickOnce, you must modify the deployment manifest of the Smart Client application because CAB modules are late bound, so ClickOnce does not know to include the CAB modules. That’s where I ran into unexplained snags and decided to switch to push using MSIs (something our IT organization is very used to doing anyway).

    Now for the Enterprise Library. In fact, yes, you can encrypt its sections. What you need to do is copy the section handlers to the system directory. To do this, go to the File System Editor in the Setup project and click on the System Folder; then, include EL section handlers. For example, to encrypt the section, you must include Microsoft.Practices.EnterpriseLibrary.Common.dll and Microsoft.Practices.EnterpriseLibrary.Security.dll in the System Folder of the Setup project. The reason for this is the msiexec.exe is installed in the system folder (usually C:\Windows\System32) and it looks for dependent assemblies in there.
    I’ll make a new post to show some screen shots of this.

    Comment by Philippe Truche — 24 March 2007 @ 4:35

  3. Hi All,

    I’m a newbie in SCSF things.. I would ask how about to update SCSF application. Right know i have SCSF April 2008 and my client ask me to deploy and update application in another way instead of Clickonce (their current method). Do you have any idea?

    Comment by Nita — 14 December 2009 @ 2:44

    • Sorry I did not see your comment earlier. Yes, you can deploy with ActiveDirectory Group Policies or you can use SMS pushes. Either way, the IT operations group must be engaged. I also recommend you take a look at the “Deploying .NET Applications Lifecycle Guide” referenced here:

      Comment by Philippe Truche — 16 February 2010 @ 10:06

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: