Tag: visual studio 2010

Microsoft ReportViewer Web控件需要ScriptManager

我正在尝试以编程方式在IHttpHandler上下文中的自定义页面内呈现报表查看器 ReportViewer rv = new ReportViewer(); ReportDataSource rds = new ReportDataSource(); rds.Name = “Report”; rv.LocalReport.ReportPath = “Report.rdlc”; rds.Value = SomeReportObject; rv.LocalReport.DataSources.Add(rds); rv.LocalReport.Refresh(); ScriptManager scriptHandler = new ScriptManager(); MyPage p = new MyPage(); p.Controls.Add(scriptHandler); p.Controls.Add(rv); using (TextWriter myTextWriter = new StringWriter()) { using (HtmlTextWriter myWriter = new HtmlTextWriter(myTextWriter)) { p.RenderControl(myWriter); } } 虽然我已将ScriptManager添加到页面但运行时抱怨ReportViewer需要一个,但它会在p.RenderControl(myWriter)行引发以下exception 报表查看器Web控件需要Web表单上的System.Web.UI.ScriptManager。 这是MyPage类 public […]

Visual Studio 2010不会停止在Socket.BeginReceive()回调中的未处理exception – 为什么?

通常,在附加调试器时,即使“exception”对话框在“已抛出”列中没有exception类型的勾号,Visual Studio 2010也会在未处理的exception处停止。 这里的关键字未处理; 所述对话框仅指处理的exception。 但是,在下面的最小示例中,Visual Studio 2010不会停止在我的exception中,即使它作为第一次机会exception出现在立即窗口中: 编辑:我发布的第一个最小的例子是我收到的第一个答案修复,但不幸的是下面的例子仍然显示问题: using System; using System.Net.Sockets; namespace SocketTest { class Program { static void Main(string[] args) { var listener = new TcpListener(8080); listener.Start(); AsyncCallback accepter = null; accepter = ar => { var socket = listener.EndAcceptSocket(ar); var buffer = new byte[65536]; AsyncCallback receiver = null; receiver = ar2 […]

来自HRESULT的exception:0x80131040

Warning 1 D:\MyPath\SomeAscx.cs: ASP.NET runtime error: Could not load file or assembly ‘HtmlAgilityPack, Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 我删除了引用,并没有在代码中使用它为什么这仍然是一个问题。 我尝试过清洁解决方案,重建,打开和关闭解决方案,但仍然没有成功。 有没有人遇到过这个问题?

为什么这个代码不能用VS 4.0在VS2010中编译?

以下代码不能在VS2010中编译,但在VS2012中编译而不做任何更改。 VS2010中有问题的一行是 names.Select(foo.GetName) 错误CS1928:’string []’不包含’Select’的定义和最佳扩展方法重载’System.Linq.Enumerable.Select (System.Collections.Generic.IEnumerable ,System。 Func )’有一些无效的参数。 using System; using System.Linq; namespace ConsoleApplication1 { class Program { static void Main() { var foo = new Foo(); var names = new[] {“Hello”}; Console.WriteLine(string.Join(“, “, names.Select(foo.GetName))); } } public class Foo { } static class Extensions { public static string GetName(this Foo foo, string name) […]

无法找到请求的.Net Framework数据提供程序。 它可能没有安装。 vs 2010和sql server 2008表达

在VS 2010中,我使用以下步骤连接到SQL Server数据库: 在服务器资源管理器窗口中,右键单击数据连接 单击添加连接 在选择数据源窗口中,选择SQL Server 单击继续,按钮 将出现“添加连接”窗口 在服务器名称文本框中键入“。\ sqlexpress” 在select或enter数据库名称中输入“Person” 单击测试连接 – 我看到“测试连接成功” 最后单击OK按钮 在第9步,我看到这个错误:“无法找到所请求的.Net Framework数据提供程序可能无法安装”

Visual Studio 2010 Professional:类图工具

我想首先在视觉上设计我的类,然后将它们转换为实际的代码。 我正在使用VS2010专业版。 请向我推荐一些好的在线资源,以获得一些好的提示和做法。 我参加了一个用户组会议中的一个很好的会议,看到类可以轻松地在视觉上设计然后转换成代码是非常鼓舞人心的。 谢谢

在构建服务器上运行TextTransform.exe(T4)

我正在尝试设置一个进程,我的T4模板将在构建服务器上进行转换(Visual Studio未安装在那里)。 我已阅读所有在线参考资料,但无法获得显示如何执行此操作的明确来源。 具体来说,这是我遇到的两个问题: TextTransform.exe抛出有关缺少DLL的错误: C:\ TeamCity \ buildAgent \ work \ AppSettings.tt(0,0):错误CS0006:编译转换:元数据文件’Microsoft.VisualStudio.TextTemplating.Interfaces.10.0,Version = 10.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a ‘无法找到 使用gacutil注册DLL文件修复了这个问题,虽然我想避免这一步。 在Visual Studio外部运行时,使用Host.ResolvePath(string)方法不返回任何值。 此方法有助于确定模板用作其数据源的.txt文件的完整路径。 没有它,在构建服务器上找不到此文件。 任何帮助将在运行中受到赞赏。 编辑:打开MS CONNECT问题: https : //connect.microsoft.com/VisualStudio/feedback/details/744137/texttransform-exe-does-not-work-without-vs2010-installed 参考资料我检查过: 获取Visual Studio以在每个构建上运行T4模板 没有Visual Studio的T4? http://msdn.microsoft.com/en-us/library/ee847423.aspx#buildserver

Visual Studio:如何管理项目之间共享的代码

这可能是之前发布的,但我不确定要查找哪些搜索条件! 快速解释。 我有几个项目之间共享的代码。 此代码本身仍在进行中。 问题在于,无论何时我需要更新此代码,我都不想这样做3次,这将成为一场噩梦。 有没有办法将它添加到项目中,而不将其复制到项目文件夹中? 即我希望共享类链接到我的3个项目中 C:\ code repository \ sharedclass.cs NOT \ eachproject \ bin \ sharedclass.cs 我是否必须将其创建为自己的库项目? 如果编译器可以将其编译为“外部”代码,那会好得多。 干杯。

C ++ / CLI-> C#错误C2526:C连接函数无法返回C ++类

我有一个使用VS2010 C#构建的简单.NET dll,它暴露了一个类的2个静态成员 public class Polygon { public static void Test(int test) {} public static void Test(List test) {} } 然后我从VS2010 C ++创建了一个Console应用程序,并在_tmain上面添加了这个函数 extern “C” void TestMe() { Polygon::Test(3); } 添加引用和编译会给我这个错误 1>WierdError.cpp(9): error C2526: ‘System::Collections::Generic::List::GetEnumerator’ : C linkage function cannot return C++ class ‘System::Collections::Generic::List::Enumerator’ 1> with 1> [ 1> T=int 1> ] 1> WierdError.cpp(9) : […]

放置在TableLayout中的停靠控件的自动大小不会小于其创建大小

这个问题比解释的更好,所以我在Visual Studio 2010项目中设置了一个git repo ,用于查看实际问题。 我有一个项目,我已经将一个ComboBox控件( comboField )添加到TableLayout控件( tableLayoutPanel1 )。 我已将ComboBox的Dock属性设置为Fill以便它填充已放入的TableLayout控件的单元格。我还将TableLayout控件的Dock属性设置为Fill以便填充Form它被放置了。 ComboBox的宽度目前为193像素。 当我运行窗体并增加其宽度时,ComboBox的大小会增加,如预期的那样。 当我减小窗体的大小时,ComboBox的大小会缩小, 直到达到原始大小(193像素)。 此时,ComboBox的宽度不会进一步减小,导致控件的右侧被剪裁。 这与我的预期相反:ComboBox的宽度将减少到零,因为没有指定MinimumSize 。 没有为MinimumSize上的任何其他控件指定MinimumSize ,例如TableLayout控件。 如果它是相关的,TableLayout的第一列的宽度设置为100像素的Absolute大小,而TableLayout的第二列的宽度已设置为AutoSize 。 任何人都可以阐明为什么这种forms的表现与我的期望相反,并建议我如何以我想要的方式运作? 任何帮助将非常感激。