Tag: visual studio 2013

尝试使用MySQL Entity Framework 6运行控制台应用程序时出现ConfigurationErrorException

我正在尝试学习如何在MySQL中使用Entity Framework 6。 由于我已经有了一个现有的数据库,所以我遵循Model First方法。 但是,我总是面对这个有用的错误消息。 在Program.cs中的这行代码中触发错误: List students = dbContext.Students.ToList(); 错误消息只是说: System.Configuration.dll中发生未处理的“System.Configuration.ConfigurationErrorsException”类型的exception附加信息:无法识别的属性“name”。 我的第一个假设是我的App.config文件有问题。 但是,我不知道它正在讨论的App.config文件中的哪个name属性。 我试图寻找现有的答案或可能的解决方案无济于事所以我决定发布我的问题希望你们帮助我。 我在用什么: Visual Studio 2013(安装在我的电脑中) MySQL Server 5.6(安装在我的电脑上) entity framework6.1.1(通过NuGet包管理器安装在我的项目中) MySql.ConnectorNET.Data 6.8.3.2(通过NuGet包管理器安装在我的项目中) MySql.ConnectorNet.Entity 6.8.3.2(通过NuGet包管理器安装在我的项目中) 我做了什么步骤: 创建了一个新的控制台应用程序 通过NuGet包管理器将已安装的Entity Framework,MySql.ConnectorNET.Data和MySql.ConnectorNet.Entity导入到项目中 使用我现有的数据库添加了名为DSWS_Model的ADO.Net实体数据模型 输入一些简单的代码,迭代并将学生列表打印到控制台中 跑 然后出现了愚蠢的运行时错误 Program.cs中 namespace MySQLEntityFramework6 { class Program { static void Main(string[] args) { Console.WriteLine(“Start?”); Console.ReadLine(); try { using (dswsEntities […]

Visual Studio 2013代码覆盖率 – 未检测二进制文件

我正在尝试使用我编写的测试在我的代码块上运行代码覆盖。 在它工作正常但现在我得到错误: 生成空结果:没有检测到二进制文件。 确保测试已运行,所需的二进制文件已加载,具有匹配的符号文件,并且未通过自定义设置排除。 有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkID=253731 我似乎无法弄清楚如何解决这个问题。 环顾四周,我看到很多人都试图去他们的项目根目录并删除那里的.suo(解决方案用户选项)文件,但这并没有解决我的问题。 我正在使用VS 2013 Ultimate

C# – Visual Studio中的System.OutOfMemoryException

我有一个问题,当我在Visual Studio中右键单击我的主窗体并转到“查看设计器”时出现错误。 它说:’抛出了’System.OutOfMemoryException’类型的exception。 堆栈跟踪: at System.Reflection.AssemblyName.nGetFileInformation(String s) at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile) at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_AssemblyName() at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_FullName() at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_AssemblySpec() at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchProjectEntries(String fullName, Boolean correctThread) at Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.IDesignTimeAssemblyLoader.GetTargetAssemblyPath(AssemblyName runtimeOrTargetAssemblyName, String suggestedAssemblyPath, FrameworkName targetFramework) at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.ResolveAssembly(AssemblyName assemblyName, Assembly runtimeAssembly) at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.GetTypeFromTargetLocation(Type type, Boolean validateBase) at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.GetType(Type type) at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(Type type, Type filter, Boolean inherit, CustomAttributesCache cache) at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.GetCustomAttributes(Type filter, Boolean inherit) […]

Microsoft ReportViewer 2012参考

我在%WINDIR%/ Assembly中有Microsoft.ReportViewer.WinForms版本11.0.0.0,publickeytoken 89845dcd8080cc91。 实际文件版本是11.0.3412.0。 我安装了2012 ReportViewer可再发行组件。 我去添加对我的.NET 4.0 C#项目的引用,唯一可用的选择是10.0.0.0,文件版本10.0.40219.329。 所以我浏览到%PROGRAMFILES%(x86)/ Microsoft Visual Studio 12.0 / ReportViewer / Microsoft.ReportViewer.WinForms.dll,它显示为11.0版本,但添加时csproj文件引用10.0版本: False C:\Program Files (x86)\Microsoft Visual Studio 12.0\ReportViewer\Microsoft.ReportViewer.WinForms.dll 当我构建并部署到32位机器时,dll的使用提示来自丢失的DLL – 10.0.0.0 – 为什么它不会拿起2012版本?

在CrystalReport中分配DataSource时发生FileNotFoundException

在报表中分配数据源时抛出System.IO.FileNotFoundException execption。 我正在使用visual studio 2013,C#4.5,WinForm应用程序。 我为visual studio 13安装了水晶报告。 这是代码 DataSet ds = new DataSet(); ds.Tables.Add(new DataTable(“administration_CashDeskManager_Reports_ReportDataBusinessObject”)); ds.Tables.Add(new DataTable(“administration_CashDeskManager_Reports_ReportDataDetailBusinessObject”)); Reports.CrystalReport.rptCashDeskTransactionLog Report = new Reports.CrystalReport.rptCashDeskTransactionLog(); Report.SetDataSource(ds); crViewer.ReportSource = Report; Report.SetDataSource(ds)命令引发错误。 我认为此错误是特定于版本的错误。 例外细节: mscorlib.dll中发生了未处理的“System.IO.FileNotFoundException”类型exception 其他信息:无法加载文件或程序集’file:/// C:\ Program Files \ SAP BusinessObjects \ Crystal Reports for .NET Framework 4.0 \ Common \ SAP BusinessObjects Enterprise XI 4.0 \ win32_x86 […]

如何将大型MVC 4应用程序划分为多个较小的应用程序?

我在Visual Studio 2013中有一个“ ASP.NET MVC 4 Web应用程序 ”,分为多个区域。 该项目规模扩大到我目前在应用程序中有大量区域的程度。 有一个特定区域可以在另一个MVC 4应用程序中自行分离。 我创建了一个新的MVC 4应用程序并将此区域移动到该应用程序。 这些是我面临的问题: 移动的区域使用原始应用程序中其他类的代码。 具体来说,共享区域包含一些属性以及BaseController 。 移动区域的视图也使用JS脚本和其他内容。 大多数情况下,使用过的脚本不是独占的或特定于使用它们的区域。 因此内容在许多领域之间交叉引用。 这是我尝试过的: 为了解决编译错误,我尝试将旧MVC应用程序的引用添加到新的MVC应用程序,以便新应用程序中的类可以看到旧应用程序中的其他类,例如共享区域中的类。 但是,这似乎没有解决问题。 为了修复JS脚本和内容问题,我创建了一个解决方案文件夹并将所有脚本移动到它。 但是,由于编译错误,我无法validation是否可行,因为我可以启动应用程序。 这是我的问题: VS2013是否提供了一些工具来分离MVC应用程序或使应用程序引用来自另一个应用程序的代码和内容? 你认为做出这种分离的最佳策略是什么? 我试图搜索SO和Google如何完成这种分离。 但是,我发现似乎适用于以前版本的MVC和VS. 因为我是新的MVC领域和MVC的概念,所以我无法解决这个问题。

使用Visual Studio在代码中查找等待的方法

我有一个问题,在代码中调用async方法而不在它前面await 。 有没有办法找到所有await ? 编辑 – 我特别关注调用多个异步方法的方案(忽略返回值),但只有一个方法await ,这足以使Visual Studio不对其发出警告。

Windows窗体中通用事件处理程序的解决方法

很久以前,我注意到Visual Studio的Windows窗体编辑器不支持包含generics类型参数的事件。 例如,像这样的事件 public event EventHandler<ListEventArgs> MyStrangeEvent { add { … } remove { … } } 哪里 public class ListEventArgs : EventArgs { List args; } 甚至没有出现在Visual Studio的属性管理器的事件列表中。 现在,这是一个有点人为的例子,可以通过重写类及其事件轻松修改以在Visual Studio中工作。 但是,我目前正在开发一个项目,由于兼容性原因我无法更改某些类。 我唯一能做的就是改变用户控件的事件。 此控件的事件当前如下所示: public event EventHandler<Plane.DrawingErrorEventArgs> DrawingError { add { _Plane.DrawingError += value; } remove { _Plane.DrawingError -= value; } } 请注意,无法更改基础Plane类(由_Plane实例表示,它是受保护的字段)。 它的DrawingError事件及其EventArgs类型在Plane类中声明如下: public […]

连接建立后如何从Server(使用连接列表)向Client发送命令?

我将这两个类作为我的服务器应用程序(桌面)的一部分,并且需要在建立连接后将命令发送回客户端。 当我尝试这样做: clients[i].Send(“info”); Send()例程( Listener.cs )是可访问的,但我有以下sintaxe错误: 怎么解决这个? Listener.cs using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Net.Sockets; class Listener { Socket s; string IP; public List clients; public delegate void ReceivedEventHandler(Listener l, Info i, string received); public event ReceivedEventHandler Received; public delegate void DisconnectedEventHandler(Listener l, Info i); public event DisconnectedEventHandler Disconnected; bool listening = […]

Listbox无法显示子类变量

我正在开发一个项目,用户正在向动物输入值(名称,年龄,性别等……),用户输入的值显示在列表框中。这些类相互inheritance。 以下是inheritance的工作原理: Animal类是所有类的父级。 哺乳动物类inheritance自Animal类。 狗类inheritance自哺乳动物类。 Cat类inheritance自Mammal类 爬虫类inheritance自Animal类 Snake类inheritance自Reptile类 Lizard类inheritance自Reptile类 Animal的变量是id , name , age , gender 。 哺乳动物的变量是牙齿 Dog的变量是barkLevel 用户可以选择要创建的动物。 有一个列表框显示动物的类型(哺乳动物和爬行动物),旁边有一个列表框,根据用户选择的动物类型,它会显示动物。 例如,如果用户在列表框中选择“ 哺乳动物 ”,则其旁边的列表框将显示“ 狗”和“ 猫” 。 这是完美的工作,这不是问题。 问题: 输入值显示在结果列表中,但不显示在子类变量中。 结果列表框显示Id , Name , Age , Gender但不显示 牙齿或barkLevel 。 没有错误消息或任何内容。 它只是不显示子类变量。 这是我的MainForm: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using […]