Tag: visual studio 2010

无法沉默嵌入互操作警告

首先,我需要使用第三方ActiveX控件。 接下来,我必须使用stdole库来为第三方控制一些图像。 当我在默认设置下编译时,我收到一些警告: warning CS1762: A reference was created to embedded interop assembly ‘c:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll’ because of an indirect reference to that assembly created by assembly ‘XXX\obj\x86\Release\Interop.ThirdPartyControl.dll’. Consider changing the ‘Embed Interop Types’ property on either assembly. warning CS1762: A reference was created to embedded interop assembly ‘c:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll’ because of an indirect reference to that assembly […]

如何在winforms应用程序中添加饼图?

我想在我的winforms应用程序中添加一个饼图 – 但我在工具箱中找到的唯一图表是常规条形图。 有没有办法将这个条形图形成饼图或通过使用一些现有的.net 4框架库(不安装任何新的库,如“DevExpress”等)将饼图组件添加到我的工具箱中?

将C ++ dll导出到c#

‘using System; ‘using System.Collections.Generic; ‘using System.Drawing; ‘using System.Windows.Forms; ‘using Emgu.CV; ‘using Emgu.CV.Structure; ‘using Emgu.CV.CvEnum; ‘using System.IO; ‘using System.Diagnostics; ‘using System.Runtime.InteropServices; ‘namespace FaceStat ‘{ ‘class Form1 : Form { // public static extern void AsmSearchDll(out int nlmarks, out int lmarks, string imgname, byte imgdata, int width, int height, int is_color, string conf_file0, string conf_file1); [DllImport(@”../data/stasm_dll.dll”)] public […]

CodeContracts:可能在空引用上调用方法

我正在使用CodeContracts静态分析工具 。 我的代码: 截图http://sofzh.miximages.com/c%23/r91zq9.png ( ASCII版 ) 该工具告诉我instance.bar可能是一个空引用。 我相信相反。 谁是对的? 我怎么能certificate它错了?

修复System.TypeInitializationException错误是什么以及如何修复?

private static void Main(string[] args) { string str = null; Logger.InitUserLogWithRotation(); // <— error occur … } 当我构建项目时,它没有错误。 但是当我执行它时,它总是中止。 我试图调试项目,但第一行发生了System.TypeInitializationException错误。 我已经尝试过谷歌搜索,但没有找到解决方案。 似乎任何变量初始化代码都是错误的,但找不到它。 请帮我。 我是C#的新手。 谢谢。 ※这是记录器类代码 public class Logger { private static int HDLOG_PRIORITY_DEBUG = 4; private static int HDLOG_PRIORITY_ERROR = 1; private static int HDLOG_PRIORITY_FATAL = 0; private static int HDLOG_PRIORITY_INFO = 3; private […]

如何在30秒后删除文件?

我正在开发一个C#项目,我需要在30秒后删除该文件。 因此,一旦文件发送到机器,我需要软件计数到30秒,然后让… 显示一个启动窗体 ,然后删除该文件。 请帮帮我。 所以在我的情况下,我将文件复制到bin / debug文件夹。 30秒后我需要删除文件.. 这是我的代码: private void button4_Click(object sender, EventArgs e) { //string filePath = image_print(); // MessageBox.Show(filePath, “path”); string s = image_print() + Print_image(); if (String.IsNullOrEmpty(s) || img_path.Text == “”) { return; } else { PrintFactory.sendTextToLPT1(s); //after this the i need the another form to pop up.. lets say […]

如何将一个项目的源文件包含在另一个项目中?

我正在用C#/ .NET编写一个类库。 我需要为两个不同的框架编译它: 4.0(用于自己调试) 3.5(在客户端使用)。 我想为这两个项目设置一个源文件,因此我可以在1个文件副本中进行更正,并自动包含在另一个项目中。 现在,如果我甚至使用“添加现有项目”,VS 2010会创建副本; 我需要每次都复制最新版本。 我不能只改变项目中的目标,因为我使用的是不同版本的.dll引用,因为ms vs有一些怪癖。

如何将必要的文件包含到独立客户端项目的输出中?

我的解决方案包括: Client – 启动项目,UI层。 取决于: App App – 库,应用程序层,汇编程序。 取决于: Lib1 ,…… Lib1 – 库,业务逻辑层。 需要特定文件才能正常工作: ThirdParty.dll 我已将ThirdParty.dll添加到Lib1项目( Add > Existing Item… > Add ),并将dll文件的“ Copy to Output Directory属性设置为Copy Always 。 现在,dll文件被复制到Lib1输出和App输出,但不会复制到我需要的Client输出。 在每个解决方案构建中将ThirdParty.dll复制到Client的输出的正确(简单?明显?)方法是什么? UPD ThirdParty.dll不是引用。 实际上,这是另一个参考依赖。 我的问题适用于需要在运行应用程序的文件夹中的任何文件。 录制的video,以确保我做得对:http: //youtu.be/QwS2tOIc5yQ

使用Properties.Settings进行应用程序设置

我使用Visual Studio提供的内置设置来存储简单的应用程序设置。 到目前为止,我已经通过使用约定在我的应用程序中访问了这个: Properties.Settings.Default.MySetting 然后使用以下方法调用Save的方法: Properties.Settings.Default.Save() 但是,有人最近告诉我,通过创建这样的成员变量来访问属性更为正确: private Properties.Settings settings = new Properties.Settings() 然后使用成员settings访问属性和方法,如: settings.MySetting settings.Save() 我模糊地回忆起他们通过描述设置存储在用户区域中的方式的不同来certificate这一点。 有人可以确认或提供有关差异的进一步细节吗? 非常感谢。

在Visual Studio 2010中,Visual Studio 2008对象测试台的function相当于什么?

我很惊讶没有在2010年找到它,如果它已经消失我会非常难过因为它同时训练和练习非常有用所以在哪里激活它? 有没有人做任何请求恢复该function?