0

I created a class in the VS code named myClass and even before deploy the same to the sandbox I immediately realized the name should be MyClass not myClass so as a solution I deleted myClass (including meta xml) and created a new class named Myclass and now when I deploy the same I get the below error

The ApexClass named myClass was not found in the workspace.

I tried deleting and re-creating MyClass several times, restarted VS code and my system also but still no luck, can someone please suggest how to get rid of this?

2
  • mayClass seems typo? Commented Oct 22, 2020 at 14:21
  • sorry my bad, updated my question
    – gs650x
    Commented Oct 22, 2020 at 14:22

2 Answers 2

1

Try to remove sourcePathInfos.json under your sfdx user (backup it just in case but it should be recreated after pull/push) or only remove entry which is causing your error (so apex class)

VS Code SFDX User

1
  • I am searching this file, sourcePathInfos.json in the whole project but didn't get any results, I can see metadataTypeInfos.json but not sourcePathInfos.json.
    – gs650x
    Commented Oct 23, 2020 at 5:34
1

I had the same issue. Some how I got rid of it but got another issue thereafter.

force-app/main/default/classes/hereClass.cls  File name mismatch with class name: HereClass

deleting the file from local repository and creating it again with same name but different case did not resolve the issue either. But we are not blocked and use any of the following options to deploy to you org.

  1. By running the following command manually in terminal.

sfdx force:source:deploy --sourcepath "<pathToTheFile>/HereClass.cls" --json --loglevel fatal

  1. right click on the apex class file HereClass.cls or HereClass.cls-meta.xml in the VScode file explorer and use the deploy command from the context menu. Note: using the same command when right clicking the in the file opened in the editor will give error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .