aaron-bond
aaron-bond

Reputation: 3341

Error detecting icon when publishing VSCode extension

I'm putting together a VSCode extension and I've already packaged up the .vsix file a few times with no issue.

However, I've just added "icon": "images/icon.png" to the package.json and started getting an error message I just can't shake:

Error: The specified icon 'extension/images/icon.png' wasn't found in the extension.

The file definitely exists (though I don't quite understand why it looks for it under extension as a hardcoded value).

I've tried setting the baseImagesUrl in the command line for packaging, but it seems to have made no difference.

Any help/insight here would be appreciated :)

Upvotes: 8

Views: 2444

Answers (5)

Move the logo.png from images/logo.png to the root and update the package.json with

"icon":"logo.png"

and vice package will work and the icon include in your extension

Upvotes: 0

Lixfeld
Lixfeld

Reputation: 253

I saved my icon with the name "icon.PNG" in the "images" folder and in my package.json I used "icon": "images/icon.png". It worked fine for me in the past but now I had to change it to "icon": "images/icon.PNG" (case sensitive!).

Upvotes: 2

BroTrustMe
BroTrustMe

Reputation: 13

I faced the same problem too.. I just renamed my icon from "Dark Icon 250.png" to "icon.png" and re-started vscode and vsce package worked.

Upvotes: 1

WSimpson
WSimpson

Reputation: 472

I had a similar problem, but it came down to the fact that the package.json had trouble with a leading forward slash. I am on windows, and was using "./" to prefix local resources in the README.md. I thought this would also work in the package.json for the icon field, but it doesn't. I removed the ./ and it started working find. It doesn't recognize either "./" or "/" BTW.

Upvotes: 4

aaron-bond
aaron-bond

Reputation: 3341

It turns out the default .vscodeignore file that is dropped when you generate the extension boiler plate code has the images/** file ignored. That stops the vsix package command from pulling the icon into the package and it won't find it.

Hope this helps someone else!

Upvotes: 15

Related Questions