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,
- I gave permission to folder for everone to modify (full control; read,write...) (İt didn't work)
I created a SSIS proxy which refers my admin account and run the script instead sql server agent. (It didn't work)
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 fromSSMS
. 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?
CodePudding user response:
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.
CodePudding user response:
As I eluded to in my comment, this may have been the issue, and I thought I should add this as an answer for anyone else coming across this question:
When SSIS projects are deployed to the SSIS catalog, there is a SQL Server version that needs to be set on the Visual Studio project. It is in the project properties under Configuration Properties > General, named TargetServerVersion.
It should be set to the correct version of the deployment server. Otherwise, tasks/components, especially script tasks/components, may not function correctly. Most of the time it will throw a version error on the server, but I have seen packages execute successfully without executing the script task/component.
There is a bug in one of the versions of either VS 2019 or the SSIS extension where the TargetServerVersion in the dialog does not reflect what the project is actually set to. This occurs when importing an SSIS project from a server. I usually go into that setting, change it to SQL Server 2019, and then back to my target version (in this case, SQL Server 2016). This forces the project to the correct version.
Hope this helps.