c# - C# 获取 System.IO.FileNotFound 异常
问题描述
我正在尝试用 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.'
解决方案
推荐阅读
- python - range() 熊猫的非空列值计数
- azure - Azure Query Performance Insights 中的 DataIO 来自哪里,当单个查询很快时
- visual-studio-code - 如何更改参数信息框字体大小?
- python - 如何以与 vcrpy 盒式磁带对 http 请求相同的方式修复流 API 的输出以用于测试目的?
- ios - Apple Identity Pinning 是否有过期日期属性?
- join - Couchbase N1QL - 尝试在 couchbase 查询编辑器中的两个文档之间执行连接操作,但没有得到任何结果
- flutter - Flutter Bottom 溢出了像素,尝试了 Column()、Row()、Container() 等等
- javascript - 如何通过 JavaScript 函数全局替换字符串中的特殊字符
- react-native - 4个图标的垂直滚动视图并在点击拍照按钮后用图片替换图标反应原生
- javascript - 动态生成列数