Why is C # import completely ruled out?

In my main method, I had a line of code -

WebRequest reqObj = WebRequest.Create(CompleteDPath + FileName);

I added import - System.Net.WebRequest. This causes an error:

The type or namespace name 'YourProject' could not be found (are you missing the using directive or assembly reference?).

The error disappears when I change the import to System.NetWhy is this happening?

In fact, I use this code inside the task of C # script SSIS, an ETL tool. I mention that if you cannot reproduce the problem in a simple visual studio and want to declare SSIS as the source of the problem.

+4
source share
1 answer

using directive (link to C #)

The using directive has two uses:

  • , :

using System.Text;

  • . using alias.

using Project = PC.MyCompany.Project;

, , using System.New.WebRequest , .

WebRequest, , :

using WebRequest = System.Net.WebRequest;

, , .

+9

All Articles