Could not load file or assembly 'System.Data.D

2019-08-07 12:44发布

问题:

I have a C# Console Application that uses System.Data.DataSetExtensions that I can run smoothly on the client's server through the command line. The only thing I did was to copy the bin/Release directory contents to a specific directory on the server and run the app through the cmd.

Now, I want to run the same app through an SQL SERVER Job. I've tried both the CmdExec and T-SQL options, the latest using xp_cmdshell. I've also tried running the program without the job, just with the xp_cmdshell on a new query tab.

I always get this error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

Can someone help me to fix this? Why can I run the program through the cmd line and not through Sql Server?

Thx a lot!

回答1:

Make sure that the database server (where SQL Server was installed) has .NET Framework 3.5 installed.