Geeks With Blogs

The Life and Times of a Dev Yes, we're really that weird
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.

Posted on Thursday, December 6, 2007 3:56 PM | Back to top


Comments on this post: ClickOnce, Mage and Visual Studio 2008 (includes fix)

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks!!!!

Tried all day to fix this, no result till I googled your solution.
Left by OD on Jan 09, 2008 9:53 AM

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

Yeah, thanks a bunch, been looking for a solution to this problem for a day or two now! Works like a charm!
Left by NS on Jan 23, 2008 3:02 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks for the info, that saved me a ton of time!
Left by Matt on Feb 01, 2008 11:12 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
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?
Left by Dan on Feb 28, 2008 6:19 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you VERY much for the post. Solved my problem perfectly.
Left by Chris Keslin on Apr 14, 2008 11:38 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Needless to say, you're a BEAUTIFUL human being.
Left by Jon on Apr 27, 2008 6:03 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you so much for the tip!
Left by Beowulf on May 29, 2008 2:16 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
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.
Left by MB on May 29, 2008 10:47 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks, yes it was helpful. Spend couple of hours but could not make out. Finally reached ur page and I am done.
Left by Rajan on Jun 19, 2008 7:28 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
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.
Left by Robert on Jul 02, 2008 6:00 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
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.
Left by Robert on Jul 02, 2008 6:02 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you. I'm at a client's site at the moment and you've just saved my life!
Left by David Kemp on Aug 21, 2008 10:57 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Great article. It was the solution that i needed. You safed me a lot of time.
Left by av on Sep 23, 2008 7:52 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
beatutiful post
Left by Chase on Oct 02, 2008 10:21 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
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.
Left by Dennis van der Stelt on Nov 27, 2008 3:18 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
For the VB guys out there... to get to the <PropertyGroup>, simply open up the .vbproj file in notepad or some other text editor.
Left by Steve Rasmussen on Dec 18, 2008 5:50 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Hmm, I see the same issue. And found myself that the embedded manifest is causing some issues. But, I see one other related issue I have yet to work around in good way:

* When enabling: "Sign the assembly" and turning off embedded manifests, there are issues (exceptions) loading WPF forms.

* Turning off Sign the assembly allows it to work, but doesn't seem like the best answer.

Any thoughts?
Left by Phil on Jan 06, 2009 1:34 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Perhaps it is enough that the ClickOnce manifests are signed to provide assurances that the assembly(s) are correct... and the other signing is unneeded (and cannot work since there is no manifest when embedding is turned off).
Left by Phil on Jan 06, 2009 1:41 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Hi all,

i still have a problem with ClickOnce, i'm becoming crazy !
I have the same config as explained on http://social.msdn.microsoft.com/forums/en-US/winformssetup/thread/8ec1ce50-26b8-4418-ae14-ddf1524c8aba/

and it works the first time i install the program. When I try to update i receive the manifest message.

Even if I set application with no manifest I there's nothing that works anymore at build time.

Any suggestion ?


Left by joelou on Jan 14, 2009 9:18 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you very much, this entry was VERY helpful!
Left by Marcin Rybacki on May 13, 2009 12:56 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Saved me a lot of head scratching. Thanks.
Left by Alan on Jun 22, 2009 2:28 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks for taking the time posting this. Solved the problem in 5 minutes thanks to you.
Left by Lars Ole on Jul 03, 2009 6:56 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
But I guess this solution won't work on Windows Vista. "Embed manifest with default settings" is required to handle UAC on Windows Vista.
Left by Ronith on Jul 17, 2009 7:40 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Still having problem with VS2008
I cannot find that minifist option in the project's property.
Left by Divyesh on Jul 31, 2009 6:02 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks a ton! This worked flawlessly!
Left by Huseyin Tufekcilerli on Aug 05, 2009 4:15 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you very much. I was banging my head on this all morning, after just upgrading to VS2008. You saved my day ;-)
Left by Bryan P Prendergast on Sep 18, 2009 3:11 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
In my case your screenshots are different from my VS2008 schema, so I search through all tabs and disabled (unthick) everything that says "manifest" and it worked! Thanks a lot for the tip! God Bless!
Left by Migra on Sep 21, 2009 5:17 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
"But I guess this solution won't work on Windows Vista. "Embed manifest with default settings" is required to handle UAC on Windows Vista."

It appears you can update that manifest to have the appropriate "identity" and it will work fine. Whatever visual studio puts in there by default is wrong, but if you make it match what's in the manifest you create with mage, it's ok.
Left by Gary on Sep 23, 2009 12:42 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks a lot for this information. I found that this problem can occur if you have other assembly references as well. In fact my issue started to happen when I was trying to "Strongly Name" my applications, I went through all referenced assemblies and by clicking on the "Strong Name" which hosed up everything for me. Somehow all of my assemblies/projects now had this "Embed Manifest with default settings" all checked. Perhaps I caused this by fooling with the Publish/Options/Manifests/"Use application Manifest for Trust" or perhaps just strongly naming the assemblies sets this flag. Arrggghhh! It took me about 4 hours of hacking until I saw this post. I went to the project that was having the difficulty and did what you suggested, all is back-to-normal. Thanks again!
Left by JP on Oct 12, 2009 1:47 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
太感谢了!!!找了好久的问题,终于找到了,
尽管是英文, 还是看懂了, 谢谢!
Left by Peter Chamn on Nov 28, 2009 8:06 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
The least I can say is thank you. My application is running now.
Left by Mahmood Salamah on Mar 16, 2010 5:49 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Many thanks, solved my problem.
Left by Nick on Apr 07, 2010 9:40 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
OMFG... I LOVE YOU MAN....

all this ClickOnce fuck... NOW ITS WORKING !
Left by MartinK on Jun 16, 2010 6:06 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
It works, thank you.
Left by ilya on Aug 05, 2010 1:20 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks a lot dude. I wasted few hours trying to figure this out, and your post saved me a day.. Thanks again
Left by Raghu on Aug 25, 2010 2:10 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks for that, helped deploying Service and Client assemblies
Got the error until I switched the setting in the service assembly properties, and I left the default on the client.

All the best, Ant
Left by Anthony Johnston on Aug 26, 2010 4:06 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Awesome :) you saved my whole day. One other thing people who are using and exe reference in the windows application project please make the same changes in the exe project too...(Go to the manifest option and change it to CREATE APPLICATION WITH OUT MANIFEST)
Left by Chaitanya on Sep 20, 2010 8:35 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks a lot, you saved us a lot of time !
Left by valerian on Sep 22, 2010 5:53 PM

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

how to solve problem for minifist in 2005 and 2008 for asp.net .

their is give an error for running program vs 2005 to vs 2008 .
Left by navnath kharat on Oct 18, 2010 2:44 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
This is also happening upgrading from 2005 up to 2010.

Thanks, you saved my day.
Left by Moko Ono on Nov 15, 2010 5:20 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Awesome! Thanks a lot!!!
Left by Dennis van der Stelt on Jan 11, 2011 3:52 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you, you saved me a lot of time
Left by Lioncall77 on Feb 05, 2011 4:45 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Love you xD
Left by Shogo on Mar 08, 2011 11:25 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you very much. It helped me
Left by Imran Mamed Aliyev on Mar 17, 2011 4:07 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
THANK YOU, YOU SAVED ME , GRACIASSSS
Left by Raul Torres on Apr 14, 2011 3:29 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thnx Bro
Left by venura on Jun 28, 2011 7:47 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you so much !!!!!
Left by RGITUS on Aug 06, 2011 1:07 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you!
Left by the on Jan 13, 2012 5:46 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Great post, this is still a issue in Visual Studio 2010
Left by Deva Wijewickrema on Mar 01, 2012 11:02 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Helped !. This helped me a lot. Thanks !
Left by peter on Mar 14, 2012 12:28 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Don't have enough words to say how much your tip helped me, and helped our project. Great thanks to you. It's wonderful that you shared your experience on the web. Thank you.
Left by Vladimir on May 31, 2013 3:20 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thank you very much.
Left by ssrdjan on Sep 21, 2013 2:22 PM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
OMG Thank You!
Left by sean on Oct 23, 2013 1:11 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
This solution is not working in VS13. When I do the work around by using VS12 its working. Any idea why?
Left by Satya on Feb 11, 2014 6:04 AM

# re: ClickOnce, Mage and Visual Studio 2008 (includes fix)
Requesting Gravatar...
Thanks gay,I appreciate for your blog.
I've take 50+ hours on the fucking mage tool,finally I got the solution on your blog.
Left by tomzzp on Apr 30, 2014 1:39 AM

Your comment:
 (will show your gravatar)


Copyright © Robert May | Powered by: GeeksWithBlogs.net