Scott Munro

Hi,

I am trying to deploy a VSTO application using ClickOnce. I am getting the following warning in Visual Studio's Error List.

Warning 1 Assembly 'VstoSmartTagDemo.dll.manifest' has mismatched identity 'VstoSmartTagDemo.manifest', expected filename: 'VstoSmartTagDemo.manifest.manifest'. C:\Programme\MSBuild\Microsoft.VisualStudio.OfficeTools.targets 0 0 

Note that the status bar displays the message "Publish Succeeded".

I notice that a file with an extension of ".manifest.manifest" is not being found. The extension seems a bit unusual, is this expected behaviour

When I go the publish location and click on the Application Manifest file, I get an error with the following text.

Application Failed
Unable to continue. The application is improperly formatted. Please contact the application publisher.

I copied the text in italics at the end of this post out of the window that opened when I clicked on the Details button.

I saw some posts about similar problems being caused by spaces in the application name. My application name is VstoSmartTagDemo which does not contain any spaces. I also move the project to folder that did not contain any spaced in the entire path without any change.

Can anyone explain what is happening here

Thanks,

Scott

PLATFORM VERSION INFO
 Windows    : 5.1.2600.131072 (Win32NT)
 Common Language Runtime  : 2.0.50215.44
 System.Deployment.dll   : 2.0.50215.44 (beta2.050215-4400)
 mscorwks.dll    : 2.0.50215.44 (beta2.050215-4400)
 dfdll.dll    : 8.0.50215.44 (beta2.050215-4400)
 dfshim.dll    : 2.0.50215.44 (beta2.050215-4400)

SOURCES
 Deployment url   :
file:///R:/FileExchange/ShortTermStore/VstoSmartTagDemo/VstoSmartTagDemo.application

ERROR SUMMARY
 Below is a summary of the errors, details of these errors are listed later in the log.
 * Activation of R:\FileExchange\ShortTermStore\VstoSmartTagDemo\VstoSmartTagDemo.application resulted in exception. Following failure messages were detected:
  + Exception reading manifest from
file:///R:/FileExchange/ShortTermStore/VstoSmartTagDemo/VstoSmartTagDemo.application: the manifest could be invalid or the file could not be opened.
  + Deployment manifest contains an invalid application dependency.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
 No transaction error was detected.

WARNINGS
 There were no warnings during this operation.

OPERATION PROGRESS STATUS
 * [23 Jun 2005 12:46:02 +02:00] : Activation of R:\FileExchange\ShortTermStore\VstoSmartTagDemo\VstoSmartTagDemo.application has started.

ERROR DETAILS
 Following errors were detected during this operation.
 * [23 Jun 2005 12:46:05 +02:00] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
  - Exception reading manifest from
file:///R:/FileExchange/ShortTermStore/VstoSmartTagDemo/VstoSmartTagDemo.application: the manifest could be invalid 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.DownloadManifest(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ManifestType manifestType, ServerInformation& serverInformation)
   at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirect(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
   at System.Deployment.Application.DownloadManager.DownloadDeploymentManifest(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, IDownloadNotification notification, DownloadOptions options)
   at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut)
   at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
  --- Inner Exception ---
  System.Deployment.Application.InvalidDeploymentException (InvalidManifest)
  - Deployment manifest contains an invalid application dependency.
  - Source: System.Deployment
  - Stack trace:
   at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSemanticsForDeploymentRole()
   at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSemantics(ManifestType manifestType)
   at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)

COMPONENT STORE TRANSACTION DETAILS
 No transaction information is available.

 




Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Scott Munro

OK, I have some more information related to this problem.

According to this document, I should be able to double click the document in my projects bin folder and have my VSTO code executed (see the text below Fig. 3). This is not the case.

http://msdn.microsoft.com/library/default.asp url=/library/en-us/odc_vsto2005_ta/html/Office_vstoApplicationManifestEditor.asp

Note that the code associated with this article seems to be based on Beta 1 and I could not get it running (it uses assemblies and classes that have since been renamed or removed).




Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Scott Munro

A little further...

After Googling for a while, I found that the association between a VSTO document and its assembly is implemented using both custom properties and an embedded manifest. The custom properties point to the manifest that is embedded inside the document itself. The manifest has information that enables the assembly itself to be located.

I can confirm that the document in my bin\debug folder has these custom properties where the one in my project folder does not.

_AssemblyName = *
_AssemblyLocation = {c8b94ef7-59b2-4817-8eba-783da1fe49f6}

This sounds like it fits with the statement I found in the article above which said that the document in the project folder would not load the assembly correctly.

Unfortunately, I still have the problem that although the document in bin\debug has custom properties, the assembly does not seem to be loaded correctly.

The ApplicationManifestEditor was implemented in VS2005 Beta1 and I have found no version that has been rewritten for VS2005 Beta 2. This (from what I understand) would have allowed me to inspect the embedded manifest and possibly allow me to track down the problem.

Are there any plans to make a VS2005 Beta 2 version of this tool available any time soon I have had a go at making the required modifications myself however the classes that it uses seems to have undergone fairly significant changes.




Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Scott Munro

This is a first. I demoed the work that I have been doing here last night and it actually worked better in the demo than while I was developing. I had never been able to open the document from my bin\debug folder complete with the VSTO logic that I had coded into it; In the demo it worked. All I can put it down to is a reboot.

I still have the problem that when I deploy the application using ClickOnce that it fails with a "The application is improperly formatted." error.




Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Scott Munro

I can now consistently create an application that loads my VSTO code. I build my application... but don't publish it. The Word document in the bin\debug folder then works as expected.

As soon as I publish the application however, it stops working; I can open the document but my code is not executed.

I was also hoping that I could simply take a copy of the functional application (before I try to publish it) and deploy it manually to get around the problems I have been having here with ClickOnce. This however does not work. Even simply renaming the Debug folder has the result that my code no longer works.

I have noticed that when the document loads successfully complete with code that a custom property named "Solution ID" is defined for the document. I used the menu combination File | Properties | Custom to see this. After renaming the debug folder and reopening the file, this property is no longer defined and the code is not loaded.

This makes me think that not all of the information required to successfully load the document is contained within the debug folder. The manifest within the word document probably references the Visual Studio Solution which somehow provides the missing information.

Once I publish the application, it should be able to be used independent of the solution and the manifest within the word document is probably updated with the missing information. Only in my case this step doesn't seem to be working correctly.




Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Scott Munro

On Friday, unless I opened the Word document from the bin\debug folder before I published the application, it would not work. The document would load however my Smart Tag would not be available.

Today, in the situations where on Friday it was not working, I am getting the following error.

The customization does not have the required permissions to execute.

This gave me the clue that the problem was permission related and once I assigned Full Trust permissions to the folder containing the renamed bin\debug folder, the application started working.

I also noticed that Visual Studio had automatically added this permission to the bin\debug folder (see the user code group VSTOProjects) which explained why it was working there.

I still did not understand why it stopped working in the bin\debug folder once I published the application until I guessed that the manifest within the document was being updated to reference the assembly in the published location. When I granted Full Trust to the published location, the application continued to work after publishing.

I tried reducing the permissions that the assembly was granted however even Everything did not work. I returned it to Full Trust but would be interested to know if there is anyway to achieve what I was trying here.

I also still have the problem that the application manifest in the published location still returns an error saying that "The application is improperly formatted.". I can however click on the Word document itself which seems to work.




Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Darryn Lavery

Hi Scott,

F5 behavior in Visual Studio
----------------------------

When you build and execute a VSTO project FullTrust is given to the assembly. The trust is removed when the project is built
to a new location. Thus as you found you can open the document from the build directory.

Publish
-------

To run your application you must double click the document itself rather than the .application file. This is the deployment manifest for your solution. Inside the publish location is a version folder containing the assembly and application manifest.

You must also grant FullTrust to the customization assembly. One alternative is to grant permission to the publish location provided that the location is secured. In that way publish updates are also trusted. The updates appear as new version folders in the publish location. Note: if you experience any problems re-publishing in beta 2 you may need to stop and re-start VS.

If you are running the document on a file share or from a web server, then the document also needs Full Trust.

Please reply if you have any further questions.

Darryn Lavery

Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.





Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Herman du Plessis

I experience the same problem.


"Could not load file or assembly 'SupportDeskAnalyse, Version=1.0.2014.31075, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)"

How do you go about when you want to grant FullTrust to the customization assembly   Is there a tool or command line

Any feedback will be appreciated.





Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Darryn Lavery

Hi Herman,

The assembly can be trusted in a number of ways (signing with a certificate, use of a strong name, providing location based evidence and combinations of). You can find more information including some examples in the security docs:

http://msdn2.microsoft.com/library/k64zb6we(en-us,vs.80).aspx

Please do not hesitate to reply if you have any further questions.

Thanks,

Darryn Lavery

Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.

 





Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Ricardo Pinto

Hello!

I developed a custom task pane with VSTO for a Word2003 report and now I would like to enable access for my clients to this document. I copied the document to a server folder in my intranet and tried opening it, but I got the same error described above in this topic:

"The customization assembly could not be found or could not be loaded"
"The customization does not have the required permissions to execute."

Therefore, I need to grant access to a server folder where the document and the assembly will be located. I checked http://msdn2.microsoft.com/library/k64zb6we(en-us,vs.80).aspx and followed the "How to: Grant Permissions to Folders and Assemblies" procedure step by step. However I still keep getting the same error!

I noticed this note "You must be an administrator to grant full trust to an assembly or folder on a network computer, and trust must be granted at the Machine level instead of the User level". Perhaps this is the problem! I've created a folder in the server and used my .NET Configuration Tool... I believe it should be done directly on the server...

Or perhaps I should use the "How to: Grant Permissions to Documents and Workbooks in Shared Locations" procedure

Can anyone help me

Thanks in advance!
Best regards,

Ricardo Pinto


Ps: here is the full error message


The customization does not have the required permissions to execute.

************** Exception Text **************
System.Security.SecurityException: The customization does not have the required permissions to execute.
   at Microsoft.VisualStudio.Tools.Applications.Runtime.DomainFactory.CreateDomain(Uri evidenceUri, String domainName, String codeBase, String configFileName, IAddinSecurityManager secman)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomainInternal(Uri uriFullDocumentDirectory, Uri uriFullDocFilePath, String documentName, IHostServiceProvider hostCallback, IAddinSecurityManager secman, AppManifest& applicationManifest, Boolean& manifestDirty, IAppInfo& appInfo)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManager.CreateCustomizationDomain(String applicationDomainPath, String documentName, IHostServiceProvider hostCallback, IExecuteCustomization& executor)
The Zone of the assembly that failed was:
MyComputer


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50215.44 (beta2.050215-4400)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50215/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50215.44
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50215.44 (beta2.050215-4400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Microsoft.Office.Tools.Common
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50215.44
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50215.44 (beta2.050215-4400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------







Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

Darryn Lavery

Hi Ricardo,

Ken has posted a reply on this thread:

http://forums.microsoft.com/msdn/ShowPost.aspx PostID=63656


Thanks,

Darryn
This posting is provided "AS IS" with no warranties, and confers no rights.




Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

FcoLomas

Hi!!

This is a really helpfully post, only one more question, Can you set anoher properties for the publish option as the install options, prerequisites, updates and more

I would like to deploy an Excel SmartDoc in an low bandwith location and I would like that it runs localy...

Thanks in advance!!






Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

EricBrown

I'm having a similar problem , when the applicaiton is downlaoded from the webserver, I get the error Popup "Cannot Continue, theapplicaiton is improperly formatted ".

We're calling the applicaiton via a URL, thusly:

http://<insertBoxIPHere>/SECWizardServer/Client/SECWizard.application

If it's called by hand, everything works fine.. but when our Routers Redirect you to a intermediate webpage which calls the page via Response.Redirect,We get the the above error with the following log. (Note the inner exception highlighted in red)

-----------------------------------------------------------------------------------

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://jobcorps.doleta.gov/ id=nosepickle

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of http://jobcorps.doleta.gov/ id=nosepickle resulted in exception. Following failure messages were detected:
+ Exception reading manifest from http://<ipaddressremoved>/SECWizardServer/AccessControl/JumpToSecWizard.aspx Agent=true: the manifest may not be valid or the file could not be opened.
+ Expected DTD markup was not found. Line 5, position 3.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.

WARNINGS
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [3/29/2007 11:03:56 AM] : Activation of http://jobcorps.doleta.gov/ id=nosepickle has started.

ERROR DETAILS
Following errors were detected during this operation.
* [3/29/2007 11:03:56 AM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Exception reading manifest from http://<ipaddressremoved>/SECWizardServer/AccessControl/JumpToSecWizard.aspx Agent=true: 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)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Inner Exception ---
System.Xml.XmlException
- Expected DTD markup was not found. Line 5, position 3.
- Source: System.Xml
- Stack trace:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.DtdParserProxy.System.Xml.IDtdParserAdapter.Throw(Exception e)
at System.Xml.DtdParser.Throw(Int32 curPos, String res, String arg)
at System.Xml.DtdParser.ScanSubsetContent()
at System.Xml.DtdParser.GetToken(Boolean needWhiteSpace)
at System.Xml.DtdParser.ParseSubset()
at System.Xml.DtdParser.ParseExternalSubset()
at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset)
at System.Xml.DtdParser.Parse(Boolean saveInternalSubset)
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Deployment.Application.ManifestValidatingReader.XmlFilteredReader.Read()
at System.Xml.XmlCharCheckingReader.Read()
at System.Xml.XsdValidatingReader.Read()
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

-----------------------------------------------------------------------------------------

Can anyone help me with some insight as to why the Manifest suddenly can't be read It was working fine up until about a week ago.

Thanks,

Eric-





Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

EricBrown

I found this about the exact error on microsoft...

http://msdn2.microsoft.com/en-us/library/ms229001(VS.80).aspx

Error message Description

Cannot continue. The application is improperly formatted. Contact the application publisher for assistance.

One of the manifest files in the deployment is syntactically not valid, or contains a hash that cannot be reconciled with the corresponding file. This error may also indicate that the manifest embedded inside an assembly is corrupted. Re-create your deployment and recompile your application, or find and fix the errors manually in your manifests.

What I don't get is how can the manifest be Corrupted if the application runs fine if you type the URL by hand.

How can redirection via a Router/Switch cause the behavior I'm seeing.

Any help is greatly appricated.

Thanks,

Eric-





Re: Visual Studio Tools for Office ClickOnce with VSTO - The application is improperly formatted.

EricBrown

It's kind of cheezy but here is how we fixed it. We changed the page so teh redirection occured in Javascript instead of .net and before we redirected we did and escape() on the url string to remove funky characters. The page redirection now worked.

Any know how to do the equivalent of escape() in .net

Thanks,

Eric-