尝试运行项目

时间:2016-03-02 07:21:33

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

我正在使用VS2015 Update 1 我只是启动一个没有特殊的新应用程序,没有数据库,没有COM引用。只是一个简单的winform应用程序。

我收到以下错误:

  

尝试运行项目时出错:无法开始调试。

     

调用的对象已与其客户端断开连接。

我的代码:

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>

2 个答案:

答案 0 :(得分:1)

尝试重新启动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 for x64环境

答案 1 :(得分:0)

试试这个:

修复“未注册64位调试程序的组件”错误 http://www.hagrin.com/326/fixing-components-64-bit-debugger-are-not-registered-error