简体   繁体   中英

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)?

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

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.

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

Additionally to the icon loading problem that I initially "solved" with Avrohom's method, I faced some issue with WebView2 not working / being loaded.

Both of these problems stopped when I disabled the click once publishing profile ( .pubxml ) option for producing a single EXE file:

<PublishSingleFile>False</PublishSingleFile>

Tested with .NET6, Visual Studio 2022

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM