ClickOnce – Exception reading manifest from file

the manifest may not be valid or the file could not be opened

This is a problem that you can run into when you publish an application using ClickOnce.

The error message provided by ClickOnce is a little obscure and there may well be a number of different causes, this posting is about what was causing the problem in my case.

This is a more complete look at the error

What Causes the Problem?

Multiple references to the same dll(s) (not necessarily just a project reference).

In our case we were pulling in non .net dll’s from two different directories that each contained about 5 dll’s that existed in both directories. Same version and everything, versioning was not causing the problem.

As soon as we removed the duplicates the problem went away.

We also experienced the same problem when we were pulling a configuration file explicitly from one location but had also added the file to the main project.Ā  So once again because a file with the same name was ‘included’ in the publish, ClickOnce throws an error because the manifest is invalid.

This guy found the problem was due to an Enterprise Library dll. I don’t know the details but I’d be willing to bet that he had a reference to two different versions of the same dll in two different projects.

Summary

While it would be nice to get a clearer error message I think what ClickOnce is doing here is pretty nice. It is making sure that you don’t get into any trouble with different references to the same file…which could be a different version and give you a world of subtle, very difficult to find bugs.

I hope this makes sense…it has been written very quickly šŸ™‚

Advertisements
    • hamit
    • June 4th, 2010

    hi there, i have faced the same problem but i did not understand which dll files couses the problem because my diployment project contains just one outlookaddin.dll and i was always used just .vsto file after other installments

    • Mike
    • March 29th, 2011

    Thanks – I threw our1200 line manifest into excel and sorted it, made it real easy to find the two duplicates.

    • Himken
    • July 19th, 2012

    Awesomeness, I struggled for too long with the same error and couldn’t figure out what the issue was. After reading this and upon closer inspection of my manifest, I saw that there were in fact 2 references to the same exe. I excluded the one from the files to be installed (Project properties –> Publish tab –> Install Mode and Settings –> Application Files), republished the app and it was sorted,

    Thanks so much šŸ™‚

  1. December 29th, 2009

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: