Okay, time to catch up a bit.

 

This last week I've been working on a DCR (fixing up the signing property page) so I haven't had time to blog. Now that it's finished, I'm going to make up for lost time and get two quick blog entries out there.

 

ClickOnce isn't available in the Express version of VS. This means that you won't be able to right click on a project and hit "Publish" and step through a nice wizard and have VS push your app out to a remote server. However, the generation of the ClickOnce manifests is part of the MSBuild system and is available to anyone with the .Net framework installed. You can take an Express project and use MSBuild to create the manifests you need to use ClickOnce today. Here's how you do it:

 

  1. Create a Strong Name key. Using the sn.exe utility that ships with the .Net framework, create a .snk file. You'll need this to sign you ClickOnce manifests. Put it in the same directory as your projects (better yet, add it to the project using the solution explorer).
  1. Open you project file in notepad. Close your Visual Studio instance and open your project file (the .csproj or .vbproj file). We need to add some new project properties to your project to enable the ClickOnce manifest generation when we run your app through MSBuild. Find the first PropertGroup tag and add the following tags:

<GenerateManifests>true</GenerateManifests>

<InstallUrl>[where your app will be installed from]</InstallUrl>

<AssemblyOriginatorKeyFile>[name of the snk file]</AssemblyOriginatorKeyFile>

The first property will do what it says: turn on manifest generation. The second property is where you want your app to be installed from; this will be placed in the manifests you generate and it can be a UNC path or a web URL. The final property is the path to the snk file you made in step one. The path can be absolute or relative to the project directory.

  1. Run MSBuild. Open a command prompt and cd to the directory of your project. The MSBuild executable is located in your framework directory. For most people, that’s at \Windows\Microsoft.Net\Framework\v2.[your version]\msbuild.exe. Type that path into your command prompt then add the command line switch /target:publish then the name of your project file. Hit enter and watch it go. When it's done, a new directory named publish there in your project directory that contains everything you need to use ClickOnce with your app.
  1. Xcopy to your server. Copy the contents of that directory to the location you specified in step 2. Send the link to your friends (they'll need the .Net Framework 2.0 Beta 1 first though) and get going!

 

There are a couple of issues you'll need to keep in mind, however. First, there is a known issue where when you load that modified project into Visual Studio, we lose the ClickOnce properties when you save. You'll have to re-add them manually. Also, the manifests you create are strong named signed and ClickOnce will block the install of strong named signed manifests that request full trust permissions (like the ones we're making here) over the internet in Beta 1. We're working on ways for small shops to use ClickOnce over the internet in Beta 2 but the best way to get things going in Beta 1 is to zip up the files and place that zip on the internet and your users can download the zip, unzip it, and install the app. You'll still get all the benefits of ClickOnce updates and app management.

 

Leave your questions and comments below!