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

delete apex class from production using Migration tool

I have to delete an apex class from Production env using migration tool. I have my destructiveChanges.xml in deletecodepkg like this


<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="">


please let me know what will be build.xml for executing this.


I am trying to use 


<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="."   xmlns:sf="antlib:com.salesforce">

    <property file=""/>
    <property environment="env"/>

     <target name="undeployCode">
      <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}"  deployRoot="deletecodepkg"/>



I have deletecodepkg,build.xml and in the same folder. when I run ant undeployCode at command prompt I get the below error


package.xml:No package.xml found


Please let me  know what is wrong in build.xml. thanks in advance.



Message Edited by sfdeveloper9 on 11-09-2009 12:22 PM
Message Edited by sfdeveloper9 on 11-19-2009 10:50 AM

Not sure if you figured this out yet but you need to have an empty package.xml file in your directory in addition to the desctructiveChanges.xml.  By empty I mean the contents should be like the following;


<?xml version="1.0" encoding="UTF-8"?>

<Package xmlns="">






Hi BenL,


what is the use of the tag <fullName>?






If the components you wanna removed are unpackaged, you should remove the tag <fullName> from both package.xml and destructiveChanges.xml.


In addition, remember not put anything else in folder deletecodepkg  except the two xml files.



I have run the ant to remove a custom obj, it works.