Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#获取System.IO.FileNotFound异常_C#_Visual Studio_System.security - Fatal编程技术网

C#获取System.IO.FileNotFound异常

C#获取System.IO.FileNotFound异常,c#,visual-studio,system.security,C#,Visual Studio,System.security,我正在尝试用C语言创建一个可以操纵鼠标光标的程序。当我调用main中的方法并运行程序时,我得到一个System.IO异常 我正在Visual Studio 2019中进行此操作。要运行下面的方法,我正在使用System.Windows.Forms和System.Drawing。我都提到过 public static void AutomateMouse() { int x = 500; int y = 500; Cursor.Position = n

我正在尝试用C语言创建一个可以操纵鼠标光标的程序。当我调用main中的方法并运行程序时,我得到一个System.IO异常

我正在Visual Studio 2019中进行此操作。要运行下面的方法,我正在使用
System.Windows.Forms
System.Drawing
。我都提到过

 public static void AutomateMouse()
 {
       int x = 500;
       int y = 500;
       Cursor.Position = new System.Drawing.Point(x, y);
       Console.WriteLine(Cursor.Position.ToString());
 }
此方法的预期结果是将光标打印到方法中指定的坐标。当我运行程序时,我在第五行得到这个异常:

System.IO.FileNotFoundException: 'Could not load file or assembly
 'System.Security.Permissions, 
Version=0.0.0.0, 
Culture=neutral, 
PublicKeyToken=cc7b13ffcd2ddd51'. 
The system cannot find the file specified.'

我建议清理和重建应用程序,并从解决方案中清除bin和obj方向。这里有点不对劲。
Version=0.0.0.0
肯定是错的-。如果重建没有帮助,那么它要么是一些问题。或者这是一个不正确的依赖项(.net framework、.net standard…)的情况。您能向我们显示您的csproj文件的内容吗(不是全部,只有System.Drawing和Permissions的framework和引用库部分)?我已经解决了这个问题。我使用的是核心而不是框架,并且与System.Drawing存在一些兼容性问题。我切换到框架,现在程序运行良好。谢谢。我建议清理和重建应用程序,并从解决方案中清除bin和obj指示。这里有点不对劲。
Version=0.0.0.0
肯定是错的-。如果重建没有帮助,那么它要么是一些问题。或者这是一个不正确的依赖项(.net framework、.net standard…)的情况。您能向我们显示您的csproj文件的内容吗(不是全部,只有System.Drawing和Permissions的framework和引用库部分)?我已经解决了这个问题。我使用的是核心而不是框架,并且与System.Drawing存在一些兼容性问题。我切换到框架,现在程序运行良好。谢谢