Tag: visual studio

Microsoft.Threading.Tasks引用不正确的System.Threading.Tasks.dll版本

我正在使用.NET framework 4.0开发一个C#库。 在这个库上我安装了这些NuGet包: 这是我的App.config内容: 在这个项目中,我正在引用System.Threading.Tasks version 2.6.10.0 。 我已经创建了一个安装程序并将该项目安装在另一台计算机 我在安装程序上添加了System.Threading.Tasks version 2.6.10.0 (在GAC上安装此dll)。 但是,当我运行可执行文件时,我收到此错误: Could not load file or assembly ‘System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. at MyProject.Common.WebApi.Client.AsyncHelpers.c__DisplayClass7 1.b__6(Object _) at MyProject.Common.WebApi.Client.AsyncHelpers.ExclusiveSynchronizationContext.BeginMessageLoop() at MyProject.Common.WebApi.Client.AsyncHelpers.RunSync[T](Func 1 task) at MyProjectCodesManagerWindowsService.WebApi.Client.MyProjectCodesManagerClient.PrepareAndStartv2(String orderNumber, String userName, String systemName) 但在所有项目中我都引用System.Threading.Tasks […]

为什么将dll从GAC复制到project \ bin文件夹

有以下情况: Windows 7 64位 Visual Studio 2010 一个包含asp.net 2.0项目的解决方案 在文件夹中:C:\ Program Files(x86)\ Reference Assemblies \ CompanyName \我有文件: Aaa.dll Aaa.pdb Aaa.xml(xmldoc)我的解决方案中的任何项目都没有引用dll(实际上我的解决方案中只有一个项目) 问题是,每次我进行构建时,dll,pdb和xml都会被复制到bin文件夹中,我得到: Could not load file or assembly ‘Aaa.dll’ or one of its dependencies. An attempt was made to load a program with an incorrect format. 如果我在运行程序之前没有删除dll。 我从来没有遇到类似的问题,我不知道如何诊断它。 有什么建议? 编辑:我忘记了。 此dll 未在项目的参考中引用 。 (我在Visual Studio项目资源管理器中没有看到它:MySolution – […]

显示datagridview中多个表的数据

我在另一列的一列n个复选框中有一个表列表。 我想通过单击复选框来查看我选择的表的数据 我的代码是 for (int i = 0; i < dataGridView2.Rows.Count; i++ ) { if (dataGridView2.Rows[i].Cells[1].Value != null) { if ((Boolean)dataGridView2.Rows[i].Cells[1].Value == true) { try { string myConnection="datasource=localhost;database=dmrc;port=3306;username=root;password=root"; MySqlConnection myConn = new MySqlConnection(myConnection); string query = "select * from dmrc." + dataGridView2.Rows[i].Cells[0].Value.ToString(); MySqlCommand cmdDatabas = new MySqlCommand(query, myConn); MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(); myDataAdapter.SelectCommand = […]

MSMQ没有调用COM

我用c#创建了一个COM对象,让VS为我注册。 我可以在注册表中看到它,如果我创建一个测试应用程序,我可以添加对它的引用,它可以按预期工作,所有方法都可用且function齐全。 现在如果我尝试在MSMQ规则中使用它没有任何反应。 它不会被调用。 这是因为它是.NET程序集吗? 是因为我没有VS Pro吗? 你有什么想法吗?

将DLL构建到单独的文件夹

第一 有几个类似的问题,但没有一个问题可以解决我的问题,也不能在其中发布。 最接近的是这个问题 。 我在这里找到了答案。 我在这里发帖,所以我可以在以后找到它。 问题:如何构建我的项目并将所有Referenced Library放在lib子文件夹中? 想要这个输出目录: 要保持这样:

C#Winforms中的自定义光标

有谁知道使用自定义光标的简单方法? 我有一个.cur和.png的光标。 我尝试将它作为资源添加到我的项目中,并尝试将其作为项目中的文件包含在内。 理想情况下我想嵌入它,但我只想让它工作。 当我使用Cursor cur = new Cursor(“mycursor.cur”)我得到“图像格式无效。图像文件可能已损坏”。 我试过这个http://mahesg.wordpress.com/2008/02/09/embedding-cursor/但它没有用。 使用WinForm1.Properties.Resources.mycursor返回一个byte [],我不知道如何转换为Cursor类型。

将文件复制到我没有权限的目录(c:或c:程序文件)

可能重复: 允许访问权限在Windows 7的Program Files中写入 好的,这是我的代码: System.IO.File.WriteAllBytes(path1, path2); 但是,有一个问题。 用户(Windows 7用户没有权限将文件复制到c:默认情况下)(…我的意思是程序…)因此,程序失败。 如果用户允许在c中复制文件:程序运行正常。 但你不能告诉每个用户“去许可……….”所以我怎样才能让用户将我的文件复制到c://

如何使用C#以编程方式获取正在运行的程序的产品(而非汇编)版本?

我有一个程序,我已经写了,我正在尝试创建一个关于框。 我最近将我的程序的产品版本更新为1.00.0003,我希望这可以反映在about窗口中。 aboutBox的默认设置显示值1.0.0.0,这是程序集版本,而不是产品版本。 从那以后,我一直在互联网上寻找如何展示产品版本。 我尝试了所有这些: { Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fileVersionInfo.ProductVersion; Debug.WriteLine(version); Debug.WriteLine(assembly.GetName().Version); string v = VersionNumber; Debug.WriteLine(v); Debug.WriteLine( fileVersionInfo.FileVersion); Debug.WriteLine(Application.ProductVersion); Debug.WriteLine(AssemblyProductVersion); Assembly assembly2 = Assembly.GetEntryAssembly(); FileVersionInfo fileVersionInfo2 = FileVersionInfo.GetVersionInfo(assembly.Location); string version2 = fileVersionInfo2.ProductVersion; Debug.WriteLine(version2); Debug.WriteLine(assembly2.GetName().Version); return version; } private string _ourVersion = “Version: v”; private string VersionNumber […]

调试类库

我的ASP.net Web应用程序中有几个类库。 BAM,我一直在调试它们没有问题。 周一早上我收到此错误,我可以点击任何断点: 以下模块是在启用优化或没有调试信息的情况下构建的: 要调试此模块,请将其项目构建配置更改为调试模式。 要禁止此消息,请禁用“如果启动时没有用户代码警告”调试器选项。 有没有人对这是什么造成任何想法? 谢谢!

无法连接到配置的开发Web服务器

当我从Visual Studio运行我的Web应用程序时,我收到以下消息: Unable to connect to the configured development web server 然后它拒绝运行。 我该如何解决这个问题?