Tag: visual studio 2012

永远不会执行加载项事件

我使用“Visual Studio的加载项”向导来创建一个新的Addin项目,现在,我正在尝试添加一些事件处理程序: public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; _applicationObject.Events.BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; _applicationObject.Events.BuildEvents.OnBuildDone += BuildEvents_OnBuildDone; _applicationObject.Events.SelectionEvents.OnChange += SelectionEvents_OnChange; _applicationObject.Events.DocumentEvents.DocumentOpened += DocumentEvents_DocumentOpened; _applicationObject.Events.DocumentEvents.DocumentSaved += DocumentEvents_DocumentSaved; } 但无论我做什么,我的处理程序都不会被执行! 我瞎了吗? 我是否必须做任何其他事情来注册这些处理程序或为什么它不起作用?

LayoutAwarePage在命名空间VS2012中不存在bug?

我正在尝试在我的Win 8应用程序上运行搜索合同,但在向我的项目添加搜索合同后,我收到以下命名空间错误: LayoutAwarePage does not exist in namespace App1.Common. 我在xaml中有正确的命名空间声明: xmlns:common=”using:App1.Common” 并且LayoutAwarePage位于正确的命名空间App1.Common中 重新启动VS2012或执行删除和重建没有帮助。 要复制此问题,请尝试以下操作: 1)创建新的空白地铁应用程序 2)添加对Visual C ++运行时的引用 3)向项目添加搜索合同(单击是以自动添加其他内容,如LayoutAwarePage等) 4)重建并打开SearchResultsPage1.xaml 如果您按照上述步骤操作,您应该看到错误,并注意SearchResultsPage1不会显示在设计器中。 只有在添加对Visual C ++运行时的引用时才会出现此问题。 没有这个参考添加搜索合同工作正常! 有任何想法吗? 我在这里想念的是什么? 你能用上面的步骤复制这个问题吗?

使用VSTest运行unit testing用例而不是MSTest

我在TFS2010服务器上有一个x64平台C#解决方案(VS2012)。 我已将unit testing项目(也是x64)附加到此解决方案并创建了构建定义。 当我对构建进行排队时,它会成功,但不会执行unit testing用例。 这是因为MSTest是一个32位应用程序。 因此,我决定自定义默认构建过程模板(DefaultTemplate.xaml)以调用VSTest(VSTest.console.exe)而不是MSTest。 这非常复杂,我无法为VSTest的工具箱添加构建活动。 有人做过这种定制吗? 我还考虑过配置.runsettings文件等其他方法。 我们是否有可以添加到.runsettings文件中的VSTest适配器接口?

将MySQL连接到Visual Studio C#

我正在尝试编写数据访问代码以将MySQL连接到visual studio。 到目前为止我有这个代码,但我不知道它是否正确。 我正在使用我的书并注释了其他一些东西,但是当我收录已注释的信息时,我收到了错误。 public static MySqlConnection getconnection() { string connectionstring = “serve=r127.0.0.1; uid = root;” + “pwd = databasses; database = group1;” MySqlConnection connection = new MySqlConnection(connectionstring); return connection; } 注释掉的信息: //string connectionstring = “Data Source=localhost\\MySql;Initial Catalog = group1; Integrated Security=True”; and //conection.Open(); 我有办法检查我的连接是否已建立? 我能够运行它并显示一个空白表格,但我担心这是错误的。

删除重复项并将列表放入列表框中

这是一项单一的任务,我遇到了部分问题。 这是代码; namespace Assignment_1 { public partial class Classifier : System.Web.UI.Page // We are using a web form as stated { protected void Page_Load(object sender, EventArgs e) // No variables are initiated for the beginning { } protected void ButtonClassify_Click(object sender, EventArgs e) { if (this.TextBox1.Text != “”) { List numbersText = this.TextBox1.Text.Split(‘,’).ToList(); foreach (var […]

WPF无边框窗口,带有影子VS2012风格

我正在尝试创建一个看起来像Visual Studio 2012的应用程序。我使用WindowChrome删除了窗口边框,并更改了我的xaml中的边框颜色。 我不知道怎么做是画出窗户的阴影,在这里你可以看到我所说的截图: 如你所见,有一个阴影,它的颜色也是边框颜色 你知道如何使用WPF实现它吗?

如何格式化Visual Studio 2012中的所有文件?

使用以前版本的Visual Studio,我使用Kevin Pilch-Bisson的脚本来格式化我的解决方案中的所有C#文件。 VS2012放弃了宏支持,因此不再适用。 如何在VS2012中轻松格式化所有文档?

如何在iOS中使用WP8中的Prefix.pch?

在iOS中我有5个使用相同代码的应用程序。 我能够使用Prefix.pch文件中的值来引用公共类并分离应用程序名称,主题和颜色。 我的前缀文件有这些, #define APPLICATION_NAME @”Application01″ #define APPLICATION_THEME @”Brown” 通过使用这些宏定义我的前缀文件,在我的程序中我可以说 #if APPPLICATION_THEME = @”Brown” -perform this- 我想在WP8中遵循相同的方法。 我不知道在哪里定义这些宏值并在代码中使用它们。 请帮助我实现这一目标。

使用Gallio从VS2012运行vstest

我很惊讶我无法在网上找到这些信息。 我们使用Sonar运行Gallio来收集测试覆盖率信息。 当Gallio运行时,它会报告以下错误。 Cannot run tests because the MSTest executable was not found 现在我们使用Visual Studio 2012.测试运行器不再是mstest,而是vstest.console.exe。 Gallio可以使用Visual Studio 2012测试运行器,如果是,那么我该如何设置呢?

无法连接到SQL数据库 – C#,VS2012,SQL Server 2012

我在Windows 7 64位PC上安装了SQL Server 2005,2008和2012。 这是我的配置管理器,我确实看到代理已停止…不确定是否需要。 我把它分成了两个图像,所以尺寸显得更大 以下是VS2012数据库资源管理器窗口中显示的内容。 这是一个SQL Server 2012数据库 这是我的代码 string selectSql = “select * from Tasks”; string connectionString = “Data Source=adamssqlserver;Database=master;Integrated Security=True;”; using (var cn = new SqlConnection(connectionString)) using (var cmd = new SqlCommand(selectSql, cn)) { cn.Open(); // this is the line that throws the error message. using (var reader = cmd.ExecuteReader()) […]