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
sfdeveloper9sfdeveloper9 

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="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>TestController</members>
        <name>ApexClass</name>
    </types>  
    <version>11.0</version>
</Package>

 

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="build.properties"/>
    <property environment="env"/>

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

</project>

 

I have deletecodepkg,build.xml and build.properties 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.

 

YP

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

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="http://soap.sforce.com/2006/04/metadata">

    <fullName>MyPkg</fullName>

   

    <version>17.0</version>

</Package> 

atlantisatlantis

Hi BenL,

 

what is the use of the tag <fullName>?

 

 

Regards,

Atlantis

atlantisatlantis

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.

 

Regards,

Thomas