'How do I force Visual Studio 2019 to generate a .deploy file for an icon for ClickOnce deployment/install
I'm running into a problem publishing/installing a ClickOnce application being built in C# in Visual Studio 2019. The application is being built using .NET Core 3.1 and WPF.
I have an icon I am using for the application that is included in the project with the filename "loader.ico". The ClickOnce manifest is calling out for loader.ico, but the required Loader.ico.deploy file is not being generated when publishing, which is throwing an exception when trying to run the setup.exe to install the application to a client PC (actual filepaths have been replaced with [Path]:
+ Downloading file:///[Path]/x64/ClickOnce/Application Files/.NET Bootloader_1_0_0_4/loader.ico.deploy did not succeed.
+ Could not find file '[Path]\x64\ClickOnce\Application Files\.NET Bootloader_1_0_0_4\loader.ico.deploy'.
I have attempted a few things using what information on the problem I could find:
I set the Build Action for loader.ico to Content and set Copy to Output Directory to Copy Always. I also set the "Settings>Application Files" setting for loader.ico to Include. This has no effect on the resulting Publish, and no loader.ico.deploy file is generated.
I also receive the following in the output window when publishing: Unable to apply publish properties for item "loader.ico"
I have also tried excluding loader.ico from the "Application Files", but this does not remove the reference in the .manifest file.
So now I am at a bit of a loss. I don't know why it would demand a .deploy file for the icon (I'd think it would just be embedded? No need for a separate icon file?). I can't seem to get the ClickOnce publishing process to generate the required loader.ico.deploy file, and I can't seem to get the manifest to remove the reference to it. What settings could be used to force the generation of this .deploy file (or force the manifest to not reference it)?
Solution 1:[1]
I can confirm from my very own experience how frustrating this is. I have tried anything and everything. For the time being - until this issue is sorted - I am suggesting that you manually add the .ico file to the Apllication_1_0_0_x folder and appending '.deploy' at the very end.
So file will look like 'my-icon.ico.deploy'.
It works. Tried and tested.
Solution 2:[2]
I had the same problem your application .ico file causes this error so you have to change its properties setting to Build Action: Content and Copy To Output Directory: Copy always. hope it works
Solution 3:[3]
In my case it helped: Publish -> Show all (Settings current project) -> Settings -> Application Files -> (Show all files): Find ico file, select publish status to Include | (Required) | Include.
From now on, the ICO file will be added when publishing
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Avrohom |
Solution 2 | AmirReza Azartoos |
Solution 3 | Bartos_Pol |