c# - 尝试运行项目时出现 VS2015 错误

标签 c# .net winforms visual-studio visual-studio-2015

<分区>

我正在使用 VS2015 更新 1 我只是开始一个没有什么特别的新应用程序,没有数据库,没有 COM 引用。只是一个简单的 winform 应用程序。

我收到以下错误:

Error while trying to run project: Unable to start debugging.

The object invoked has disconnected from its clients.

我的代码:

public partial class RegistratorForm : Form
{
    public RegistratorForm()
    {
        InitializeComponent();
    }

    private void RegistratorFileBrowseButton_Click(object sender, EventArgs e)
    {
        using (var openDialog = new OpenFileDialog())
        {
            openDialog.Title = "Open Text File";
            openDialog.Filter = "Registrator files|*.rgr";
            openDialog.InitialDirectory = ConfigurationManager.AppSettings["DefaultRegistratorFilePath"];
            if (openDialog.ShowDialog() == DialogResult.OK)
            {

            }
        }
    }
}

我的表格:

enter image description here

我的 app.config 文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <appSettings>
     <add key="DefaultRegistratorFilePath" value="C:\"/>
   </appSettings>
</configuration>

最佳答案

尝试重新启动 Visual Studio。这应该够了吧。 如果没有,那么你应该按照建议做 here

  1. 检查从源代码控制引擎更新后更改了哪些文件(原因和方式)
  2. 查看扩展和插件列表。尝试禁用全部或部分
  3. 关闭 Visual Studio 并终止所有开发进程:devenv、mspdbsrv、vcpkgsrv、msbuild、conhost、msvsmon 等
  4. 删除解决方案的 .suo 和 .ncb 文件,这有时会导致问题
  5. 删除项目设置文件,例如 YourProjectName.vcproj.DOMAINNAME.LOGINNAME.user 或 YourProjectName.csproj.user。
  6. 设置文件名取决于您使用的项目类型 运行“C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe”/setup 或“C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe”/setup x64 环境

关于c# - 尝试运行项目时出现 VS2015 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35740836/

相关文章:

.net - 缺少 Visual Studio MSVCP110D.dll

vb.net 确定屏幕

c# - 如何在 TreeView 控件中显示滚动条

c# - 从 Windows 窗体应用程序打开 AutoCAD

c# - 在 TabControl 中对 TabPages 进行分组

c# - 正确地在 ASP.NET 中进行锁定

c# - 使用 SQL Server 在 Linq 中查询投票应用程序的帮助

c# - 为什么 BeforeFieldInit 行为在 .NET 4 中发生了变化?

javascript - 在 asp.net MVC 中更改文本框日期时的消防 Controller 代码

c# - 估算 Web 应用时间的经验法则