Search code examples
c#filessispermissionsssms

SSIS script task (c#) works in Visual Studio well. But when I run it in SSMS it runs succesfully but does nothing


I I prepared a simple c# script that can rename a file on my local directory. When I run it in visual studio it completes successfully and rename the file. the code below;

public void Main()
{
   // TODO: Add your code here
   string path = @"D:\DataFiles\IQVIAData\BrickWeekly\BrickWeeklyData\201226_FACT_ALL_SALES_147.txt";
   string path2 = @"D:\DataFiles\IQVIAData\BrickWeekly\BrickWeeklyData\ASD.txt";
   File.Move(path, path2);
   Dts.TaskResult = (int)ScriptResults.Success;
}

From SSMS when I execute the SSIS package which script task included, it runs and it says succesfully completed but the file is still with the same name and it didn't rename the file.

Here what I did before texting here,

  1. I gave permission to folder for everone to modify (full control; read,write...) (İt didn't work)

enter image description here

  1. I created a SSIS proxy which refers my admin account and run the script instead sql server agent. (It didn't work) enter image description here

  2. I changed the folder path randomly which does not exist like that path. When I run it visual studio gave error like; there is no folder with this name etc... This was what I expect it. After that I deployed the package to sql server and run the package from SSMS. But it didnt give me any error despite there is a mistake with folder path. It runs succusfully.

    public void Main()
    {
        // TODO: Add your code here
        string path = @"D:\DataFiles\IQVIAData\BrickWeekly\BrickWeeklyData\201226_FACT_ALL_SALES_147.txt";
        string path2 = @"D:\DataFiles\IQVIAData\BrickWeekly\asdasd\ASD.txt";
        File.Move(path, path2);
        Dts.TaskResult = (int)ScriptResults.Success;
    }
    

Any ideas or advice to solve my problem?


Solution

  • There is something wrong with viusal studio, maybe it is about settings. Bu I couldn't figure out. I installed visual studio 2019 and create the package with it. After deployment It worked properly. Thanks for advices.