1

We have a project with a similar structure:

  • Project A
    • Additional Files
      • FileA.json
      • FileB.json
  • Project B

Project B is our main project in this case and includes project A. Everything works fine when I build and run it. It also works fine, after I publish the application inside a simple folder and copy&paste it to the other machine.

Since we want to deploy the application on a network drive and want the application to automatically update, we want to use "ClickOnce" (Azure and Docker are sadly no options). When I click "Publish" everything works as intended, I get all the files, and when I move them to the network drive I can easily install the application on the devices (they also check for updates).

The only problem I have: The "Additional Files" folder from project A does not get copied during the installation! This means that the application cannot use those files and does not work. In Visual Studio I set those files Copy to Output Directory to Copy always. Additionally, I have tried to change the Build Action, but that is of no use. If I check the published output, the folder is there. It is just not copied during the installation.

Is there any way to tell the ClickOnce installer to move this folder as well during installation?

Zumpel
  • 82
  • 19
  • Based on my test, I set Copy to Output Directory to Copy always and Build Action to content. I can see the folder and files successfully after the installation. Where do you want to see the two files? – Jack J Jun Apr 20 '21 at 06:28
  • I have exactly this setup and it does not move the files. I want them to be in the installation folder, since Project A tries to load the file with the path "./Additional Files/FileA.json". Keep in mind, that this path is just a placeholder and there is no space in the path. The only workaround I have for now is, that I move the files to "C:/MyProject/Files" or something like that and load it directly from there. But I want to avoid this, since this approach is counter intuitive for users. – Zumpel Apr 20 '21 at 06:34
  • Just as a little additional info: The files are in the publish folder! Once I run the process everything is there. If I start the .exe located in that folder, everything works as well. Its literally just about the installation process of ClickOnce. – Zumpel Apr 20 '21 at 06:54
  • you can refer to the link [Where does ClickOnce put files?](https://social.msdn.microsoft.com/Forums/en-US/c6e3d328-1deb-49c9-99cf-98fe3830702a/where-does-clickonce-put-files?forum=winformssetup) to check if your file exists after you install the app. – Jack J Jun Apr 20 '21 at 06:56

1 Answers1

2

I found the solution. After reading this (outdated) guide from the documentation (https://learn.microsoft.com/en-us/visualstudio/deployment/how-to-specify-which-files-are-published-by-clickonce?view=vs-2019) I finally figured it out.

When creating or editing a publishing profile, when you reach the point Settings, you can include files by clicking the Application Files button. For some strange reason, those files were not even visible at first. But after pressing Show all files I saw, that those files were excluded. I changed it to include and everything works as intended now.

Zumpel
  • 82
  • 19
  • I am glad to hear that your problem has been solved, you can click '✔' to mark your reply as an answer. It will also help others to solve the similar issue. – Jack J Jun Apr 26 '21 at 08:09