function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Paulina Nogal 5Paulina Nogal 5 

Unexpected file found in package directory error, when adding SLDS svg icons

The instructions on adding Salesforce Lightning Design System's icons aren't clear to me, or just doesn't work for me. In my template I'm trying to use an example icon:

<svg aria-hidden="true" class="slds-icon" title="when needed">
  <use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#case"></use>
</svg>

and I also downloaded the icon's package and included it in the assets folder, so that the path to the svg is correct. When I try to push that change, I'm receiving the following console error:

ERROR running force:source:push:  Unexpected file found in package directory
What are the step by step instructions on how to use the icons (https://www.lightningdesignsystem.com/components/icons/)? Thank you!
AbhishekAbhishek (Salesforce Developers) 
Hi,

Your query has answered this blog,

https://salesforce.stackexchange.com/questions/192736/salesforce-dx-unexpected-file-found-in-package-package-xml

Try the suggestions as mentioned above it help you.

For your reference,

https://developer.salesforce.com/blogs/developer-relations/2017/07/migrating-existing-projects-salesforce-dx.html

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.


Thanks.
 
Paulina Nogal 5Paulina Nogal 5

Hello Abhishek!

Thank you for responding. 

Unfortunately, I am still having the same issue. I tried following the steps in the first link, and added the path in sfdx-project.json as:

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    },
    {
      "path": "force-app/main/default/lwc/assets/icons/License-for-icons.txt"
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "47.0"
}


The path is correct, but I'm still getting the console error: ERROR running force:source:push:  Unexpected file found in package directory: /my-path.../force-app/main/default/lwc/assets/icons/License-for-icons.txt

I also tried following the steps from the second link you shared with me, but I've been getting the following error: ERROR running force:mdapi:convert:  the path specified is not a directory or doesn’t contain a package.xml

I got that error after running: sfdx force:mdapi:convert -r ./assets/icons FROM the directory above the assets folder.

I don't know if the issue is because I'm not including the LDS Icons correctly, but I do follow the steps just it is specified on the website. maybe some steps are missing there? Do you have experience adding the Lightning Icons package to the project? I follow the steps included on the LDS website (https://www.lightningdesignsystem.com/components/icons/). 

This should be an easy step to complete but is getting very frustrating - all I want to do is to use the icons in my project. I will appreciate some more help!