Life in my own company

Its all up to me.
posts - 137, comments - 166, trackbacks - 113

My Links

News



Twitter



Tag Cloud

Archives

Post Categories

Play

Work

ClickOnce, Mage and Visual Studio 2008 (includes fix)

Technorati Tags: ,,,

A few days ago I wrote about issues I was having with Mage and click once.  Basically, I was always getting the following when I'd try to install the click once application:

 

PLATFORM VERSION INFO
    Windows             : 5.2.3790.131072 (Win32NT)
    Common Language Runtime     : 2.0.50727.1433
    System.Deployment.dll         : 2.0.50727.1433 (REDBITS.050727-1400)
    mscorwks.dll             : 2.0.50727.1433 (REDBITS.050727-1400)
    dfdll.dll             : 2.0.50727.1433 (REDBITS.050727-1400)
    dfshim.dll             : 2.0.50727.1433 (REDBITS.050727-1400)

SOURCES
    Deployment url            : https://myurll/builds/myapp/ClickOnceTrial.application
                        Server        : Microsoft-IIS/6.0
                        X-Powered-By    : ASP.NET
    Deployment Provider url        : https://myurl/builds/myapp/ClickOnceTrial.application
    Application url            : https://myurl/builds/myapp/ClickOnceTrial/ClickOnceTrial.exe.manifest
                        Server        : Microsoft-IIS/6.0
                        X-Powered-By    : ASP.NET

IDENTITIES
    Deployment Identity        : ClickOnceTrial.app, Version=1.0.0.0, Culture=neutral, PublicKeyToken=13376ffc050464a3, processorArchitecture=msil
    Application Identity        : ClickOnceTrial.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=13376ffc050464a3, processorArchitecture=msil, type=win32

APPLICATION SUMMARY
    * Installable application.

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of https://myurl/builds/myapp/ClickOnceTrial.application resulted in exception. Following failure messages were detected:
        + Reference in the manifest does not match the identity of the downloaded assembly ClickOnceTrial.exe.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [12/4/2007 1:56:12 PM] : Activation of https://myurl/builds/myapp/ClickOnceTrial.application has started.
    * [12/4/2007 1:56:13 PM] : Processing of deployment manifest has successfully completed.
    * [12/4/2007 1:56:13 PM] : Installation of the application has started.
    * [12/4/2007 1:56:13 PM] : Processing of application manifest has successfully completed.
    * [12/4/2007 1:56:16 PM] : Request of trust and detection of platform is complete.

ERROR DETAILS
    Following errors were detected during this operation.
    * [12/4/2007 1:56:17 PM] System.Deployment.Application.InvalidDeploymentException (RefDefValidation)
        - Reference in the manifest does not match the identity of the downloaded assembly ClickOnceTrial.exe.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
            at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
            at System.Deployment.Application.FileDownloader.OnModified()
            at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
            at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
            at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
            at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

COMPONENT STORE TRANSACTION DETAILS
    No transaction information is available.

 

It didn't matter what we did.  We ALWAYS received that error message.  The odd thing was that we had just moved to Visual Studio 2008 and things had been working GREAT using Visual Studio 2005.  We're doing our building using MSBuild and CruiseControl.Net and the mage lines looked like the following:

 

  <!-- create new application manifest -->
        <Exec Command="mage.exe -New Application -FromDirectory $(CurrentDeployDir) -ToFile $(CurrentDeployDir)\MyApp.exe.manifest -Name &quot;MyApp&quot; -Version $(BuildLabel) -TrustLevel FullTrust"/>
        <Exec Command="mage.exe -Sign $(CurrentDeployDir)\MyApp.exe.manifest -CertFile $(DeployDir)\certFile.pfx -Password mypassword"/>    
    <Exec WorkingDirectory="$(DeployTempDir)" Command="mage.exe -New Deployment -ToFile MyApp.application -Version $(BuildLabel) -Name &quot;MyApp&quot; -providerUrl https://myurl/builds/myapp/myapp.application -AppManifest $(BuildLabel)\myapp.exe.manifest"></Exec>
        <Exec Command="mage.exe -Sign $(DeployTempDir)\MyApp.application -CertFile $(DeployDir)\certFile.pfx -Password mypassword"></Exec>

So we made a simple sample application to see if we could reproduce it and using MageUI we were able to cause it to happen, and so was Microsoft!

After about 8 hours on the phone and many more hours by Ravi, who did a great job, we figured out that a new feature of Visual Studio 2008 was causing problems.  Basically, VS 2008 can embed a manifest inside of an assembly.  Mage was somehow using this manifest in it's manifest generation, resulting in a duplicate manifest being created.  As soon as we changed the build to no longer embed the manifest, it worked fine!

Go to the application's properties and under the application tab you'll see this:

image

 

To fix the problem, change the second combo box to be this:

image

Save and you should be up and running again.

Before you make the change, this is what the main property group looks like:

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9337119A-578C-4DE4-A9E0-697DBB7FD7CD}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ClickOnceTrial</RootNamespace>
    <AssemblyName>ClickOnceTrial</AssemblyName>
    <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>

After making the change, it now looks like this:

 

 <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9337119A-578C-4DE4-A9E0-697DBB7FD7CD}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ClickOnceTrial</RootNamespace>
    <AssemblyName>ClickOnceTrial</AssemblyName>
    <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
    <NoWin32Manifest>true</NoWin32Manifest>
  </PropertyGroup>

So you could manually add the NoWin32Manifest property and it would also make it work.

Hopefully this will save someone else a little time.

Print | posted on Thursday, December 06, 2007 3:56 PM |

Feedback

Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Thanks!!!!

Tried all day to fix this, no result till I googled your solution.
1/9/2008 9:53 AM | OD
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)


Yeah, thanks a bunch, been looking for a solution to this problem for a day or two now! Works like a charm!
1/23/2008 3:02 AM | NS
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Thanks for the info, that saved me a ton of time!
2/1/2008 11:12 AM | Matt
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Great post, and extremely useful if you're having this problem and you're developing using C#.

However, if you're writing a VB app, as I am, that option isn't present in Visual Studio. So there's no way to use the GUI to turn this off. I tried hacking it into the project files themselves, which definitely has an effect, but still won't allow the build process to complete. It essentially complains that both /nowin32manifest and /win32manifest are being provided.

Might this be a VB.net bug in 2008?
2/28/2008 6:19 AM | Dan
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Thank you VERY much for the post. Solved my problem perfectly.
4/14/2008 11:38 AM | Chris Keslin
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Needless to say, you're a BEAUTIFUL human being.
4/27/2008 6:03 PM | Jon
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

For those vb people out there. this is what I did ant it worked for me

If the <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> section I added the following 2 lines right before the closing PropertyGroup tag

<NoWin32Manifest>true</NoWin32Manifest>
<GenerateManifests>false</GenerateManifests>

5/16/2008 8:28 AM | Mike
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Thank you so much for the tip!
5/29/2008 2:16 PM | Beowulf
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

How exactly can I add the lines suggested for vb users?

<NoWin32Manifest>true</NoWin32Manifest>
<GenerateManifests>false</GenerateManifests>

It may be simple but I just don't where the <PropertyGroup> is located and how to access it.
5/29/2008 10:47 PM | MB
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Thanks, yes it was helpful. Spend couple of hours but could not make out. Finally reached ur page and I am done.
6/19/2008 7:28 AM | Rajan
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Um--Mage isn't a 3rd party tool, it's a Microsoft Tool and its specifically designed for generating click once manifests and applications. If you're going to automate a click once build, you're probably going to end up using Mage.

When you have a large, distributed team and a central build server, which doesn't have vs 2008 installed on it, and you're builds are completely automated, "Letting VS 2008 do the job for you" is rather impractical. Sure, it'll work great if you're the only developer, but that's not the case here.
7/2/2008 6:00 PM | Robert
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

The above comment was in response to the following from JB:

"Has anyone considered the possibility that the new feature in VS 2008 is intended to replace the 3rd party / post-build manifest tasks?
Don't jump to the conclusion that turning manifest embedding off is the correct solution. If the default manifests don't fit your solution, maybe you should create a custom one, include your .pfx files in the project as well, and let VS 2008 do the job for you. No more reliance on mage, or post-build tasks."

The comment I responded to didn't appear, not sure why.
7/2/2008 6:02 PM | Robert
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Thank you. I'm at a client's site at the moment and you've just saved my life!
8/21/2008 10:57 AM | David Kemp
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Great article. It was the solution that i needed. You safed me a lot of time.
9/23/2008 7:52 AM | av
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

beatutiful post
10/2/2008 10:21 AM | Chase
Gravatar

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)

Excellent post, thanks for the info!

I've added it to the comments of a post of my own where I explain how to do a ClickOnce build manually, using mage.exe and FinalBuilder. I won't shamelessly link directly.

Again, thanks for the info. This took me a while.
11/27/2008 3:18 AM | Dennis van der Stelt

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 7 and type the answer here:

Powered by: