views:

646

answers:

2

Hi,

I have a solution that is deployed using ClickOnce.

It consists of an application, serveral 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, LibLLCExtenders.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 witch 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?

+2  A: 

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...

Daok
I'll try that solution for now... need to get this new version deployed asap, had some breaking changes.Thnx for the info m8
TimothyP
That did the trick :-) Been able to deploy now, saved my ass :)
TimothyP
No problem ;) Always glad to help :)
Daok
+1  A: 

Let me get this right: you're using Visual Studio's publish feature to create and deploy the ClickOnce package?

Good luck with that.

You might be better off building your own ClickOnce packages using Mage.

I started down the Visual Studio route, and quickly discovered it was the path to misery. Learn how to use Mage, and then look at some of the MSBuild options for "automating" this.

David Kemp
I forgot all about mage, tried it back in the days when ClickOnce was a real PITA :pI'll look into that.
TimothyP
ClickOnce is a still a PITA
David Kemp