When you import a custom visual and then delete it, it is still stored in Power BI Desktop file.
This can be checked by opening the file as archive.
It does not matter whether a visual is added from Store or from file.
Uploading to Power BI service and downloading it back does not help.
I have found a workaround:
Note that if you delete a visual in Power BI Desktop, it will still appear in Power BI service, so the workaround will still work.
I can't reproduce this issue. I have tried to install them both from the buttons in ribbon and the functions in the visualization pane.
1. Which version of Desktop do you have? Please upgrade to Version: 2.51.4885.701 64-bit (October 2017) if needed.
2. Could you please provide your .pbix file that I can use to reproduce?
3. Which visual did you use? Maybe it's related to a special visual.
Note that when you open the file, you cannot see any custom visuals, but you can see them both in the file structure and when you publish the dataset to Power BI service.
I have reported this internally to Power BI Team: CRI 50507720. Any updates will be posted here.
I have got response from the Product Team.
They have added the issue to the backlog. And also there is a more detailed workaround:
1. In PBI Service, Open the report in "Edit mode" by clicking "Edit report"
2. In the Visualization Pane, For every unwanted custom visual:
2.1.Right-click on the custom visual's icon.
2.2. A hovering menu appears, with a "Delete custom visual" option. Click on it.
2.3. A "Delete custom visual" dialog is displayed, click on "Delete".
3. Save the report (click "File" dropdown, select "Save").
4. Download the report's pbix file (click "File" dropdown, select "Download report").
Use the downloaded report file for future PBI Desktop work on the report.
The issue still persists in Power BI Desktop. Any updates on this?