Geeks With Blogs

News

Google My Blog


Murray Gordon Flash a-ah! Savior of the universe...

 

If anyone has any experience with MSBUILD and Mage.exe to build ClickOnce projects, please let me know if you might be able to help.

I used Mike Bouck’s blog on ClickOnce as a guide. (great post Mike) http://blog.gatosoft.com/PermaLink,guid,d0a0dd1e-c9ac-4fa9-a408-615454d49702.aspx

I'm having a similar issue from this post in the Microsoft forums: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=664144&SiteID=1

 

I'm using mage.exe as a part of an MSBuild project.

 

Here's the error I get when I try to run the application (the highlighted part contains my error summary – included as attachment also): 

 

PLATFORM VERSION INFO
Windows : 5.1.2600.131072 (Win32NT)
Common Language Runtime : 2.0.50727.42
System.Deployment.dll : 2.0.50727.42 (RTM.050727-4200)
mscorwks.dll : 2.0.50727.42 (RTM.050727-4200)
dfdll.dll : 2.0.50727.42 (RTM.050727-4200)
dfshim.dll : 2.0.50727.42 (RTM.050727-4200)

SOURCES
Deployment url : http://localhost/Flicker.ClickOnce/local/ControlNET.application
Server : Microsoft-IIS/5.1
X-Powered-By : ASP.NET
Deployment Provider url : http://localhost/Flicker.ClickOnce/Local/ControlNET.application
Server : Microsoft-IIS/5.1
X-Powered-By : ASP.NET
Application url : http://localhost/Flicker.ClickOnce/Local/ControlNET.exe.manifest
Server : Microsoft-IIS/5.1
X-Powered-By : ASP.NET

IDENTITIES
Deployment Identity : ControlNET ClickOnce (Local).application, Version=2.2.244.2, Culture=neutral, PublicKeyToken=cd4d78a2e5181877, processorArchitecture=msil
Application Identity : ControlNET ClickOnce (Local).exe, Version=2.2.244.2, Culture=neutral, PublicKeyToken=cd4d78a2e5181877, 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 http://localhost/Flicker.ClickOnce/local/ControlNET.application resulted in exception. Following failure messages were detected:
+ Manifest XML signature is not valid.
+ No signature was present in the subject.



COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.

WARNINGS
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [9/1/2006 6:01:32 PM] : Activation of http://localhost/Flicker.ClickOnce/local/ControlNET.application has started.
* [9/1/2006 6:01:33 PM] : Processing of deployment manifest has successfully completed.
* [9/1/2006 6:01:33 PM] : Installation of the application has started.
* [9/1/2006 6:01:33 PM] : Processing of application manifest has successfully completed.
* [9/1/2006 6:01:36 PM] : Request of trust and detection of platform is complete.

ERROR DETAILS
Following errors were detected during this operation.
* [9/1/2006 6:01:43 PM] System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
- Manifest XML signature is not valid.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
at System.Deployment.Application.ComponentVerifier.VerifyStrongNameAssembly(String filePath, AssemblyManifest assemblyManifest)
at System.Deployment.Application.ComponentVerifier.StrongNameAssemblyComponent.Verify()
at System.Deployment.Application.ComponentVerifier.VerifyComponents()
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)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Inner Exception ---
System.Security.Cryptography.CryptographicException
- No signature was present in the subject.

- Source: System.Deployment
- Stack trace:
at System.Deployment.Internal.CodeSigning.SignedCmiManifest.Verify(CmiManifestVerifyFlags verifyFlags)
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

 

 

Here's what my MSBuild project looks like (I highlighted my MAGE executes and the GenerateManifests... Can't figure out what might be wrong) Also included as attachment:

 

 

<?xml version="1.0" encoding="utf-8"?>

<Project DefaultTargets="Deploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

      <Import Project="Microsoft.Sdc.Common.tasks"/>

 

      <PropertyGroup>

            <Configuration Condition="'$(Environment)' == ''">Local</Configuration>

            <PublishDir>Publish</PublishDir>

            <SolutionName>ControlNET</SolutionName>

            <SupportUrl>http://tempuri.org</SupportUrl>

            <SigningCert>CambarCodeSigning.pfx</SigningCert>

            <SigningCertPassword>cambar</SigningCertPassword>

            <Company>Cambar Solutions</Company>

      </PropertyGroup>

 

      <Choose>

            <When Condition=" '$(Environment)'=='Local' ">

                  <PropertyGroup>

                        <SourceDir>bin\Debug</SourceDir>

                        <ConfigDir>Config\Local</ConfigDir>

                        <ClickOnceVirtualRootDir>Flicker.ClickOnce\Local</ClickOnceVirtualRootDir>

                        <ClickOnceUrl>http://localhost/Flicker.ClickOnce/Local/</ClickOnceUrl>

                        <ClickOnceApplicationUrl>$(ClickOnceUrl)$(SolutionName).application</ClickOnceApplicationUrl>

                        <ClickOnceAppTitle>ControlNET ClickOnce (Local)</ClickOnceAppTitle>

                  </PropertyGroup>

            </When>

            <When Condition=" '$(Environment)'=='Dev' ">

                  <PropertyGroup>

                        <SourceDir>bin\Debug</SourceDir>

                        <ConfigDir>Config\Dev</ConfigDir>

                        <ClickOnceVirtualRootDir>Flicker.ClickOnce\Dev</ClickOnceVirtualRootDir>

                        <ClickOnceUrl>http://localhost/Flicker.ClickOnce/Dev/</ClickOnceUrl>

                        <ClickOnceApplicationUrl>$(ClickOnceUrl)$(SolutionName).application</ClickOnceApplicationUrl>

                        <ClickOnceAppTitle>ControlNET ClickOnce (Dev)</ClickOnceAppTitle>

                  </PropertyGroup>

            </When>

            <When Condition=" '$(Environment)'=='Test' ">

                  <PropertyGroup>

                        <SourceDir>bin\Release</SourceDir>

                        <ConfigDir>Config\Test</ConfigDir>

                        <ClickOnceVirtualRootDir>Flicker.ClickOnce\Test</ClickOnceVirtualRootDir>

                        <ClickOnceUrl>http://localhost/Flicker.ClickOnce/Test/</ClickOnceUrl>

                        <ClickOnceApplicationUrl>$(ClickOnceUrl)$(SolutionName).application</ClickOnceApplicationUrl>

                        <ClickOnceAppTitle>ControlNET ClickOnce (Test)</ClickOnceAppTitle>

                  </PropertyGroup>

            </When>

            <When Condition=" '$(Environment)'=='Prod' ">

                  <PropertyGroup>

                        <SourceDir>bin\Release</SourceDir>

                        <ConfigDir>Config\Prod</ConfigDir>

                        <ClickOnceVirtualRootDir>Flicker.ClickOnce\Prod</ClickOnceVirtualRootDir>

                        <ClickOnceUrl>http://localhost/Flicker.ClickOnce/Prod/</ClickOnceUrl>

                        <ClickOnceApplicationUrl>$(ClickOnceUrl)$(SolutionName).application</ClickOnceApplicationUrl>

                        <ClickOnceAppTitle>ControlNET ClickOnce</ClickOnceAppTitle>

                  </PropertyGroup>

            </When>

      </Choose>

 

      <ItemGroup>

            <SourceFiles Include="$(SourceDir)\**\*.*" Exclude="$(SourceDir)\**\*.pdb;$(SourceDir)\**\*.vshost*"/>

      </ItemGroup>

 

      <ItemGroup>

            <AppConfigFile Include="$(ConfigDir)\App.config"/>

      </ItemGroup>

 

      <ItemGroup>

            <GetVersionAssembly Include="$(SourceDir)\$(SolutionName).exe"/>

      </ItemGroup>

 

      <ItemGroup>

            <ClickOnceLandingPage Include="ClickOnceLandingPage.htm"/>

      </ItemGroup>

 

      <ItemGroup>

            <BootstrapperFile Include="Microsoft.Net.Framework.2.0">

                  <ProductName>.NET Framework 2.0</ProductName>

            </BootstrapperFile>

      </ItemGroup>

 

      <ItemGroup>

            <ClickOnceInstallationFiles Include="$(SolutionName).application"/>

            <ClickOnceInstallationFiles Include="$(SolutionName).exe.manifest"/>

            <ClickOnceInstallationFiles Include="setup.exe"/>

            <ClickOnceInstallationFiles Include="default.htm"/>

      </ItemGroup>

 

      <Target Name="Deploy" DependsOnTargets="PrepareClickOnceDeployment;DeleteVirtualRootFiles;CopyFilesToVirtualRoot"/>

 

      <Target Name="GetVersion">

            <Message Text="Getting version info..."/>

            <GetAssemblyIdentity AssemblyFiles="@(GetVersionAssembly)">

                  <Output TaskParameter="Assemblies"

                              ItemName="GetVersionAssemblyInfo"/>

            </GetAssemblyIdentity>

      </Target>

 

      <Target Name="GetPublishContent">

            <Exec Command="rd /s /q $(MSBuildProjectDirectory)\$(PublishDir)"/>

            <Copy  SourceFiles="@(SourceFiles)"

                     DestinationFiles="@(SourceFiles->'$(PublishDir)\%(RecursiveDir)%(Filename)%(Extension)')"/>

            <Copy  SourceFiles="@(AppConfigFile)"

                     DestinationFiles="$(PublishDir)\$(SolutionName).exe.config"/>

            <Copy  SourceFiles="@(ClickOnceLandingPage)"

                     DestinationFiles="default.htm"/>

      </Target>

 

      <Target Name="PrepareClickOnceDeployment" DependsOnTargets="GetPublishContent;GetVersion">

            <Message Text="Preparing for ClickOnce deployment for version %(GetVersionAssemblyInfo.Version)..."/>

            <CreateItem Include="$(PublishDir)\**\*.*">

                  <Output TaskParameter="Include" ItemName="AppManifestContents"/>

            </CreateItem>

            <ModifyFile

                  Path="default.htm"

                  RegularExpression="#APPLICATION_NAME#"

                  NewValue="$(SolutionName)"

                  Force="true"/>

            <ModifyFile

                  Path="default.htm"

                  RegularExpression="#TITLE#"

                  NewValue="$(ClickOnceAppTitle)"

                  Force="true"/>

            <ModifyFile

                  Path="default.htm"

                  RegularExpression="#VERSION#"

                  NewValue="%(GetVersionAssemblyInfo.Version)"

                  Force="true"/>

            <ModifyFile

                  Path="default.htm"

                  RegularExpression="#COMPANY#"

                  NewValue="$(Company)"

                  Force="true"/>

            <ModifyFile

                  Path="default.htm"

                  RegularExpression="#SUPPORT_URL#"

                  NewValue="$(SupportUrl)"

                  Force="true"/>

            <Exec Command="mage.exe -New Application -TrustLevel FullTrust -ToFile $(SolutionName).exe.manifest -Name &quot;$(ClickOnceAppTitle)&quot; -Version %(GetVersionAssemblyInfo.Version) -FromDirectory $(PublishDir)"/>

            <ModifyFile

              Path="$(SolutionName).exe.manifest"

              RegularExpression="&lt;application /&gt;"

              NewValue="&lt;description asmv2:iconFile=&quot;$(SolutionName).ico&quot; xmlns=&quot;urn:schemas-microsoft-com:asm.v1&quot; /&gt;&lt;application /&gt;"

              Force="true"/>

            <Exec Command="mage.exe -Sign $(SolutionName).exe.manifest -CertFile $(SigningCert) -Password $(SigningCertPassword)"/>

            <GenerateDeploymentManifest AssemblyName="$(ClickOnceAppTitle).application"

                                                      AssemblyVersion="%(GetVersionAssemblyInfo.Version)"

                                                      DeploymentUrl="$(ClickOnceApplicationUrl)"

                                                      Description="Hagemeyer N.A. ControlNET ERP System"

                                                      Product="$(ClickOnceAppTitle)"

                                                      Publisher="$(Company)"

                                                      SupportUrl="$(SupportUrl)"

                                                      EntryPoint="$(SolutionName).exe.manifest"

                                                      Install="true"

                                                      UpdateEnabled="true"

                                                      UpdateMode="Background"

                                                      OutputManifest="$(SolutionName).application"

                                                      MapFileExtensions="true"/>

            <Exec Command="mage.exe -Sign $(SolutionName).application -CertFile $(SigningCert) -Password $(SigningCertPassword)"/>

            <GetFrameworkSdkPath>

                  <Output TaskParameter="Path" PropertyName="SdkPath" />

            </GetFrameworkSdkPath>

            <GenerateBootstrapper

              ApplicationFile="$(SolutionName).application"

              ApplicationName="$(ClickOnceAppTitle)"

              ApplicationUrl="$(ClickOnceUrl)"

              BootstrapperItems="@(BootstrapperFile)"

              Culture="en"

              FallbackCulture="en-US"

              CopyComponents="true"

              Validate="false"

              Path="$(SdkPath)\Bootstrapper"

              OutputPath="." />

      </Target>

 

      <Target Name="DeleteVirtualRootFiles">

            <Message Text="Deleting files/directories from $(ClickOnceVirtualRootDir)..."/>

            <Exec Command="del /f /s /q $(MSBuildProjectDirectory)\$(ClickOnceVirtualRootDir)\*.*"/>

      </Target>

 

      <Target Name="CopyFilesToVirtualRoot" DependsOnTargets="PrepareClickOnceDeployment;DeleteVirtualRootFiles">

            <Message Text="Copying files to $(ClickOnceVirtualRootDir)..."/>

            <Copy  SourceFiles="@(ClickOnceInstallationFiles)"

                     DestinationFiles="@(ClickOnceInstallationFiles->'$(ClickOnceVirtualRootDir)\%(Filename)%(Extension)')"/>

            <Copy  SourceFiles="@(AppManifestContents)"

                     DestinationFiles="@(AppManifestContents->'$(ClickOnceVirtualRootDir)\%(RecursiveDir)%(Filename)%(Extension).deploy')"/>

      </Target>

 

</Project>

 

 

Any idea what I might be missing?

 

The publish works great in VS2005

 

Running the Publish target in MSBuild without an MSBuild project, against the csproj file works, but doesn't give me an HTML page to launch with, hence the MSBuild project.

 

I can't figure out what I might be missing here.

 

Let me know if anyone might be able to help.

 

Thanks,
Murray Gordon

 

Posted on Wednesday, September 6, 2006 8:36 AM .NET Framework 2.0 | Back to top


Comments on this post: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
Hi Murray,
I had the very same problem today when I attempted to use Mike Bouck’s blog entry as a guide to enabling my build process for clickonce deployment. I agree with you Mike's blog post is very helpfull. It gave me a huge jump start on the problem. By looking at the deploy.log file that is created I was able to determine that in my case a 2nd manifest was being inluded in the clickonce package. I think this second manifest file was left over from when I was trying to do ClickOnce with VS 2005. Once I removed it Brian's deploy.proj (which I modified for my purpose) and deploy.cmd worked just fine. So have a look at your deploy.log file to see if any warnings are showing up when mage is called to create the new application manifest. It might be finding another manifest file in the from directory.

Mike Linnen
Left by Mike Linnen on Oct 30, 2006 7:04 PM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
Mike, thanks for the info. I will check that out.

-Murray
Left by Murray Gordon on Oct 31, 2006 8:44 AM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
Is there a way to include your data files in this?
Left by Mario on Oct 31, 2006 4:05 PM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
I had to go into the PROJ file that the clickonce was enabled on and set the GenerateManifests property to false. This stopped VS 2005 from creating it's manifest file during compile.

Mike Linnen
Left by Mike Linnen on Nov 01, 2006 6:30 AM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
I am working on a windows forms app. I do my development in a development environment, and I have certain settings in my app.config like connection strings that point to my development SQL server.



When I deploy my Application with ClickOnce, those settings are going to have to be updated to their production values. What is the recommended method for managing this? I can't imagine modifying the app.config on production and then having to start over again with the development values the next time i publish.
THANKS !!!
Left by ae on Sep 06, 2008 7:42 AM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
I definitely feel your pain here. I actually use automated build tools to help with with that headache.

My favorite is AutomatedQA's Automated Build Studio.

Here's the link:
http://www.automatedqa.com/products/abs/index.asp

It's not cheap, but really saved time. There are other products out there to help.

You can also use Microsoft Visual Studio Team System and MSBuild.

I would recommend finding a tool that meets your needs and budget. If you have to repeat it, you can script it. :-)

Good luck,
Murray




Left by Murray Gordon on Sep 07, 2008 8:39 PM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
Please, any solution about it ??? please

send me email for notification, mister.
Left by alhambra eidos on Oct 30, 2008 8:53 AM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
I have the same issue with the app.config, and that the Update location is different for testing versus production too.

Here's my idea that I will try on Monday,
in VS2008 build as normal, and publish to the Test lab.

For production,
1.) Copy the production app.config into the version dir.
2.) Using mage.exe , write a script that will create new MyApp.Application and MyApp.exe.manifest files

Does this sound reasonable, or am I heading down the wrong path?

Thanks,
Todd
Left by Todd Kneib on Dec 05, 2008 6:40 PM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
I've been in the process of converting my nant continous build server over to msbuild. My first exposure with msbuild has left me less than impressed (I would've preferred msft spend time and money just creating a msbuild task for nant/nant contrib -- but i'll blog about that later).
Left by multiplayer casino online on Jul 23, 2009 1:45 AM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
any solutions, please ? thanks
Left by ae on Jan 21, 2010 7:41 AM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
Hi,

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=664144&SiteID=1 fails, 404 not found.

thanks !!!
Left by reale on Jan 21, 2010 7:43 AM

# re: MSBUILD + MAGE.EXE = ClickOnce (Need some help... Experts welcome :-) )
Requesting Gravatar...
Hi all,

I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1).

I need do this programatically,

Get a list of all listener in loggingConfiguration

Modify property fileName=".\Trazas\Excepciones.log" of several RollingFlatFileTraceListener's

Modify several properties of AuthenticatingEmailTraceListener listener,

Any help, please, I havent found any reference or samples

Thanks in advanced. Greetings

<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="ImplServicioBase" logWarningsWhenNoCategoriesMatch="true">

<listeners>

<add name="Excepciones RollingFile Listener" fileName=".\Trazas\Excepciones.log"
formatter="Text Single Formatter"
footer="&lt;/Excepcion&gt;"
header="&lt;Excepcion&gt;"
rollFileExistsBehavior="Overwrite" rollInterval="None" rollSizeKB="1500" timeStampPattern="yyyy-MM-dd"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />


<add name="AuthEmailTraceListener"
type="zzzz.Frk.Logging.AuthEmailTraceListener.AuthenticatingEmailTraceListener, zzzz.Frk.Logging.AuthEmailTraceListener"
listenerDataType="zzzz.Frk.Logging.AuthEmailTraceListener.AuthenticatingEmailTraceListenerData, zzzz.Frk.Logging.AuthEmailTraceListener"
formatter="Exception Formatter"
traceOutputOptions="None"
toAddress="xxxx@gmail.com"
fromAddress="xxxx@gmail.com"
subjectLineStarter=" Excepción detectada - "
subjectLineEnder="incidencias"
smtpServer="smtp.gmail.com"
smtpPort="587"
authenticate="true"
username="xxxxxxx@gmail.com"
password="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
enableSsl="true"
/>
Left by reale on Apr 14, 2010 2:20 PM

Your comment:
 (will show your gravatar)


Copyright © Murray Gordon | Powered by: GeeksWithBlogs.net