1

I have a program (solution) in Visual Studio 2022 and I need to publish it as a setup.exe application. My application is a simple face recognition using the haarcascade_frontalface_alt.xml file. I need to publish my C# soultion with this .xml file included.

I tried to publish it using ClickOnce, but the haarcascade_frontalface_alt.xml file is always missing. I have a relative path to this file in the program and it is located in the Resources folder. I have set the properties of the .xml file as build action content and copy if newer. I really dont know where is the problem because the haarcascade file is in publish folder in format .deploy. I attach screenshot of my application files folderApplication files folder in publish folder and generated folder from setup.exe in AppData/Local/Apps. You can see the haarcascade file is missing in Apps folder.Apps folder

I would be very grateful if someone could help me :)

d0nbell
  • 11
  • 1
  • Change the mode of the project to Release and then copy the xml file to the bin sub folder of the Release folder and then hit build. – Son of Man Apr 11 '23 at 12:59
  • Note that you can add a file resource as well. You can then access its content as `string` like this: `string xml = Properties.Resources.MyFileResource;`. Or add the file to your project and set its property "Copy to Output directory` to `Copy if newer` in the properties window. – Olivier Jacot-Descombes Apr 11 '23 at 13:02

0 Answers0