1

I have a machine with a clean install of Windows 7 where I want to install my app.

I've built a WPF App on Windows 10 with prerequisites of .NET 4.5 and Visual C++ Redistributable Packages for Visual Studio 2013

I've included them in my Clickonce installer as Prerequisites:

enter image description here

enter image description here

If I attempt to run the .application file that is generated from Clickonce on the Windows 7 machine, I get the following error:

Cannot Continue. The application is improperly formatted. Contact the application vendor for assistance.

However, I run the setup.exe on my Windows 7 machine it correctly prompts that it needs to install .NET 4.5 and Visual C++ Redistributable Packages for Visual Studio 2013. It then successfully goes through the install process for each Prerequisite.

Except, after the Prerequisites are installed, I receive the same The application is improperly formatted. error from above.

If I then re-run the .application file it will finally install.

Either way, this is definitely not a good user experience. Is this something to do with building the App on Windows 10 and attempting to install on Windows 7?

I've seen this question which seems similar, however I am installing .NET 4.5 as a prerequisite:

Manifest may not be valid or the file could not be opened.

Below are the error details:

PLATFORM VERSION INFO
    Windows             : 6.1.7601.65536 (Win32NT)
    Common Language Runtime     : 2.0.50727.5420
    System.Deployment.dll       : 2.0.50727.5420 (Win7SP1.050727-5400)
    mscorwks.dll            : 2.0.50727.5420 (Win7SP1.050727-5400)
    dfdll.dll           : 2.0.50727.4927 (NetFXspW7.050727-4900)
    dfshim.dll          : 4.0.40305.0 (Main.040305-0000)

SOURCES
    Deployment url          : file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application

ERROR SUMMARY
    Below is a summary of the errors, details of these errors are listed later in the log.
    * Activation of C:\Users\BHS\Desktop\New folder\BHSScaleOps.application resulted in exception. Following failure messages were detected:
        + Exception reading manifest from file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application: the manifest may not be valid or the file could not be opened.
        + Manifest XML signature is not valid.
        + SignatureDescription could not be created for the signature algorithm supplied.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [3/21/2017 4:20:01 PM] : Activation of C:\Users\BHS\Desktop\New folder\BHSScaleOps.application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [3/21/2017 4:20:01 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
        - Exception reading manifest from file:///C:/Users/BHS/Desktop/New%20folder/BHSScaleOps.application: the manifest may not be valid or the file could not be opened.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        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.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
        --- Inner Exception ---
        System.Security.Cryptography.CryptographicException
        - SignatureDescription could not be created for the signature algorithm supplied.
        - Source: System.Security
        - Stack trace:
            at System.Security.Cryptography.Xml.SignedXml.CheckSignedInfo(AsymmetricAlgorithm key)
            at System.Security.Cryptography.Xml.SignedXml.CheckSignatureReturningKey(AsymmetricAlgorithm& signingKey)
            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.
Community
  • 1
  • 1
aherrick
  • 19,799
  • 33
  • 112
  • 188

1 Answers1

0

Your manifest is signed using SHA-256. When you try to install the ClickOnce application on a machine which has only .NET 4.0 installed you receive the Manifest XML signature is not valid error you mentioned because up to .NET 4.0 SHA-1 is expected.

This is why after you successfully installed .NET 4.5 as prerequisite everything works fine. I have no idea why this isn't working in a single step but requires two steps instead. Perhaps this relates to a restart required after installing the new framework version?

The solution is to use SHA-1 when signing your manifest. You can find information on how to achieve this in this answer from Miroslav Nedyalkov.

Community
  • 1
  • 1
The Chairman
  • 7,087
  • 2
  • 36
  • 44