0

I want to deploy using metadata API. I have class classes/MyPackage__UninstallClass.cls with MyPackage namespace classes/MyPackage2__UninstallClass.cls with MyPackage2 namespace. But when I try to deploy Salesforce give me error message:

File name mismatch with class name: UninstallClass I can not to rename class as MyPackage__UninstallClass Maybe it is necessary to add something in addition into package.xml or in MyPackage__UninstallClass.cls-meta.xml. What I should do?

  • What are you trying to do specifically? You can't update a class in a managed package (that's what "managed" means). – sfdcfox Jan 24 '19 at 16:49
0

First be sure that you are trying to update an unmanaged or unlocked package. You cannot update managed packages.

Second, your package,xml file needs to have the package name in the fullname parameter, but the Apex class name does not have a namespace. For example:

    <?xml version='1.0' encoding='UTF-8'?>
    <Package xmlns="http://soap.sforce.com/2006/04/metadata">
        <fullName>MyPackage2</fullName>
        <types>
            <members>UninstallClass.cls</members>
            <name>ApexClass</name>
        </types>
        <version>42.0</version>
    </Package>

Lastly, be sure that the class name in your actual code matches the file name:

    public class UninstallClass {
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.