I have a WinForms, C# solution that uses ClickOnce deployment that is causing some trouble with resource files. In short, files marked as Content in class library project do not get copied to the output bin/ folders after I deploy with ClickOnce.
Here is the basic structure of the solution (it contains a lot more projects then the ones I list below)
Solution
|--Gui 1 Project
| |--References
| | |--ClassLibrary
|--Gui 2 Project
| |--References
| | |--ClassLibrary
|--Main Gui Project (StartUp Project)
| |--References
| | |--Gui 1 Project
| | |--Gui 2 Project
| | |--ClassLibrary
| |--Datafile.wav (Build Action: Content, Copy-if-newer)
| |--Mods.xml (Build Action: Content, Copy-if-newer)
| |--VariousSourceFiles.cs
|--ClassLibrary
| |--Resources
| | |--Elements.xml (Build Action: Content, Copy-if-newer)
| | |--AminoAcids.xml (Build Action: Content, Copy-if-newer)
| |--VariousSourceFiles.cs
The Main Gui project is the StartUp project for this program and is a simple MDI container that launches the other GUI applications within it. When I build in either Debug/Release mode on my development machine, everything works as expected. The GUI programs are compiled, the Datafile.wav and Mods.xml files are copied to the bin/ folder and the Elements.xml and AminoAcids.xml files are copied to the bin/Resources/ folder. The program functions as expected with no hiccups.
Here is where the problem begins, I use the Click-Once publishing feature in VS2010 to release the program internally to my co-workers on our server. They are able to install the program just fine and even start it up. But as soon as they click on a button that uses one of the resource files (Elements.xml or AminoAcids.xml) it throws an exception that the file cannot be found. This doesn't happen for the other two content files (Datafile.wav and Mods.xml) in other words, those are correctly copied to the final directory.
So I go to Main Gui Project -> Properties -> Publish -> Application Files.. and I see that the Datafile.wav and Mods.xml are included in this list. However, the other two content files (Elements.xml and AminoAcids.xml) are not. I believe this is the problem, because when I publish the program to our server, it doesn't know to copy the resources over. How would I inform ClickOnce that they need to include these files? The ClassLibrary.dll shows up in this list, but none of the .xml files.
I then tried to go to ClassLibrary -> Properties -> Publish but there is no tab for Publish because it is a Class Library. So I am unable to specify that I want those two resource files to be copied to the final bin/Resources file on any client computer. Does any have any idea how to overcome this?
I would like to keep the resource files (.xml) as Build Action: Content and not Embedded Resources since the users of the program might change/update/expand the contents of the files.