R – ClickOnce – Overwriting content files


I have a solution that is deployed using ClickOnce.

It consists of an application, several referenced assemblies
and a SQL Server Compact database.

There is also an assembly which is not referenced by the main application,
but simply loaded at runtime. This assembly needs to be deployed along with
the application, in the same directory as the application binaries.

I set up Visual Studio to copy the "plugin" assembly to the \bin\debug (or \bin\release)
directory of the UI project after compilation.

I then added the file to the UI project,
not as a reference but simply as a file. I set the build action to "Content", this
way it shows up in the Properties/Publish dialogs of the UI project.

When I first published the application, it worked like a charm.
But then I updated the plugin assembly, even gave it a different version number
and published again, only to find the assembly had not been updated but the first
one ever uploaded was still being used. (Even on a clean computer with no prior install).

I did some digging and found that the assembly (LibComposites.dll) was copied
to both the directory where clickonce applications store their binaries
as the directory where they store the data files.

In both cases, the first ever published version.

In overview, I have an application that references some assemblies:

Control.exe references –>
LibLLC.dll, LibDataLayer.dll,
loads at
runtime –> LibComposites.dll (which
also references LibLLC.dll)

I need to deploy a new version of LibComposites.dll to the same directory
as the application which each publish.

Why is the first ever published version of that assembly still being used

How can I force LibComposites.dll to be overwritten by every publish?

Best Solution

Alright, I had the SAME problem. Here is how I solve it (might not be the ideal but it works.

1) If your dll or file is inside the solution, I would take it off and re-add it. 2) Go inside the property of your project and select Publish and Application Files. You need to have your file there and to select AGAIN "Include" (not the Auto one...).

Than you will be able to publish with the new one. I do not know why it doesn't work if I do not do that but each Publish, I have to do these steps to be able to get the last version...

Related Question