views:

158

answers:

2

I want to execute the oracle's import utility in MSBuild as a task. Please give a detailed answer. I am a beginner.

+1  A: 

You may want to look into the MSBuild Exec task. I am not familiar with the Oracle utility you specified, but I do know that the Exec task will run most anything that can be run from a command line. The relevant MSBuild configuration you would need might looks something like this:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    <Target Name="DoImport">
        <Exec 
      Command="imp SYSTEM/password FILE=dba.dmp FROMUSER=scott TABLES=(dept,emp)" />
    </Target>
</Project>
Saul Dolgin
+1  A: 

A somewhat more long-winded but better solution is to develop a custom Task that extends the ToolTask base class. This will allow better logging and you can define the arguments by using specific XML attributes.

I've developed one for SqlPlus and it works really well.

PenFold