我注意到我的一个项目引用了3个不同版本的mscorlib:
1.0.5000.02.0.0.04.0.0.0
这篇关于"mscorlib.dll和System.dll "的帖子帮助我理解了mscorlib的用途,但我想知道应用程序是否正常/必需要求此程序集的多个版本.也许这是因为我将我的项目从VS 2005升级到VS 2010.
是否有可能让我的项目仅引用mscorlib的4.0.0.0版本?
我正在创建一个C++/CLI DLL,它将被加载到遗留的c ++应用程序中.传统应用程序通过对LoadLibrary的传统调用来完成此操作.应用程序和C++/CLI dll都以64位模式编译.
当LoadLibrary调用发生时,它会因错误193而失败.这通常意味着某些非64位组件正在尝试加载.当我在visual studio 2010中查看dll加载输出时,我看到加载mscoree.dll时发生了故障(确切地说,我看到我的dll加载,然后mscoree加载,然后mscoree卸载,然后我的dll卸载,然后返回错误).特别是C:\ Windows\System32\mscoree.dll正在加载,当我检查这个mscoree.dll时,我发现它的目标是I386.
如何确保我的应用程序将链接到正确的mscoree.dll?我知道这可以用清单来完成,但我找不到任何关于设置清单的好信息.理想的解决方案是允许在32位或64位模式下编译并定位正确的mscoree.dll.
作为旁注,我发现并行文件夹中的mscoree.dll是我验证的64位模式,并将其复制到我的应用程序目录中,希望它能先获取该文件.这不起作用,仍然加载C:\ Windows\System32版本.
谢谢,
马克斯
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v4.0.30319
CLR Header: 2.5
PE : PE32+
CorFlags : 16
ILONLY : 0
32BIT : 0
Signed : 0
Run Code Online (Sandbox Code Playgroud)
PS C:\Windows\System32> pedump.exe .\mscoree.dll
Dump of file .\MSCOREE.DLL
File Header
Machine: 014C (I386)
Number of Sections: 0004
TimeDateStamp: 4B90752B -> Thu Mar 04 22:06:19 2010
PointerToSymbolTable: …Run Code Online (Sandbox Code Playgroud) 在使用Java的NetBeans中,我可以打开java.lang.String类,然后看到该类源代码.如果我尝试在VisualStudio中打开System.String类,我只会看到方法签名.是否可以安装VisualStudio插件或类似的东西来按F12打开mscorlib类源代码?
谢谢你的回答.我找到了最适合我的解决方案:http://visualstudiogallery.msdn.microsoft.com/95789cdb-08f9-4dae-9b2f-fc45a452ad77
我需要一个ReadOnlyDictionary.所有帖子告诉我,.Net 4.0中没有.出于这个原因,我创建了自己的实现.
在做完Resharper 5.1后告诉我一个模糊的引用,System.Collections.ObjectsModel.ReadOnlyDictionary但代码编译没有错误.
我试图使用此实现,但它无法访问.为什么?
我编写了以下代码来测试ReadOnlyDictionary.Net 4.0中是否存在:
var foo = from assembly in AppDomain.CurrentDomain.GetAssemblies()
where assembly.FullName.Contains("mscorlib")
from type in assembly.GetTypes()
where type.Name.StartsWith("ReadOnly")
select type.FullName + " " + assembly.FullName;
Run Code Online (Sandbox Code Playgroud)
令人惊讶的结果是:
System.Collections.ReadOnlyCollectionBase mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Collections.ObjectModel.ReadOnlyCollection`1 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Collections.ObjectModel.ReadOnlyDictionary`2 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Collections.ObjectModel.ReadOnlyDictionaryHelpers mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Runtime.InteropServices.WindowsRuntime.ReadOnlyDictionaryKeyCollection`2 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Runtime.InteropServices.WindowsRuntime.ReadOnlyDictionaryKeyEnumerator`2 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Runtime.InteropServices.WindowsRuntime.ReadOnlyDictionaryValueCollection`2 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Runtime.InteropServices.WindowsRuntime.ReadOnlyDictionaryValueEnumerator`2 mscorlib, Version=4.0.0.0, Culture=neutral, …Run Code Online (Sandbox Code Playgroud) 我在 Visual Studio 2015 中编写了一个应用程序,它使用 C# 6.0 功能并针对 .NET 4.5.2。当我使用 Microsoft Build Tools 2015 构建它时,这是由我们的 TeamCity 服务器完成的,生成的 bin 文件夹还包含mscorlib.dll. 这里的问题是 mscorlib.dll被复制的是 .NET 4.6 DLL,这会导致运行时出现问题。
我已经用string.Format()新的字符串插值语法替换了我的调用来解决这个问题。然而,这将根本问题推到了地毯下,而不是解决它:为什么 .NET 4.6 DLL 包含在我的构建中,我如何强制将 4.5.2 DLL 包含在它的位置?
如果您对这给我造成的运行时问题感兴趣,它会导致我的:
string.Format(CultureInfo.InvariantCulture, "{0}='{1}'", "key", "value")
Run Code Online (Sandbox Code Playgroud)
被解释为(链接——仅存在于 .NET 4.6 中):
System.String System.String.Format(System.IFormatProvider, System.String, System.Object, System.Object)
Run Code Online (Sandbox Code Playgroud)
而不是(链接):
System.String System.String.Format(System.IFormatProvider, System.String, params System.Object[])
Run Code Online (Sandbox Code Playgroud) 我正在尝试更新服务引用,但出现以下错误:
无法为目标框架“.NETFramework,Version=v4.0”解析 mscorlib。如果未安装目标框架或框架名字对象的格式不正确,就会发生这种情况。
先感谢您!我正在编写一个应用程序来读取txt文件并写入Excel.从小做起我只是想读第一行.
Console.WriteLine正确输出字符串(字符之间有空格),但是当我尝试从字符串中提取字符时,我收到此错误:附加信息:索引和长度必须引用字符串中的位置.
while ((input = stream.ReadLine()) != null)
{
//ACH HEADER LINE
if (iCurRecLine == 0 && input.IndexOf(HeaderBeginKeyWord) >= 0)
{
Console.WriteLine(input);
RepDate = input.Substring(23, 6).Trim();
RecordTypeCode = input.Substring(0, 1).Trim();
PriorityCode = input.Substring(1, 2).Trim();
ImmDestination = input.Substring(3, 10).Trim();
ImmOrigin = input.Substring(13, 10).Trim();
FileCreatedDate = input.Substring(23, 6).Trim();
FileCreatedTime = input.Substring(29, 4).Trim();
FileIDModifier = input.Substring(33, 1).Trim();
RecordSize = input.Substring(34, 3).Trim();
BlockingFactor = input.Substring(37, 2).Trim();
FormatCode = input.Substring(39, 1).Trim();
Destination = input.Substring(40, 23).Trim();
Origin = input.Substring(63, 23).Trim();
ReferenceCode = input.Substring(86, 8).Trim();
...
} …Run Code Online (Sandbox Code Playgroud) 我在Web服务中调用方法时遇到以下错误,而不是由我开发.
mscorlib.dll中发生了未处理的"System.ServiceModel.CommunicationException"类型异常
它不仅发生在我的本地开发机器上,而且发生在部署软件时也发生在客户端的服务器上.
我目前正在使用Visual Studio 2010.
在 ASP.NET Web 表单中按钮的 OnClick 方法中,我调用了 Response.Redirect(),这会导致系统中止线程并显示错误消息:
Exception thrown: 'System.Threading.ThreadAbortException' in mscorlib.dll
Run Code Online (Sandbox Code Playgroud)
这里有一些与此类似的问题,使用我更改的解决方案:
Response.Redirect("~/UI/Home.aspx");
Run Code Online (Sandbox Code Playgroud)
到
Response.Redirect("~/UI/Home.aspx", false);
Context.ApplicationInstance.CompleteRequest();
Run Code Online (Sandbox Code Playgroud)
但是我仍然遇到同样的问题。我使用调试器运行了代码,一切都成功执行,直到我调用 Response.Redirect();。
点击函数
protected void btnLogin_Click(object sender, EventArgs e)
{
SiteUser s = null;
try
{
string email = txtEmail.Text;
string pwd = txtPwd.Text;
s = DBConnection.login(email, pwd);
}
catch (Exception ex)
{
Console.Write(ex);
lblLoginError.Text = "Error logging in.";
}
if (s != null)
{
Session["UserSession"] = s;
Response.Redirect("~/UI/Home.aspx", false);
Context.ApplicationInstance.CompleteRequest();
}
else
{
lblLoginError.Text = "User not found. Please check your …Run Code Online (Sandbox Code Playgroud) 从Visual Studio 2010构建Outlook 2007插件的安装项目时出现此错误.
安装项目没有什么复杂的,只是使用标准机制.
我知道它无法找到该文件.什么是normnfc.nlp?它有什么作用?我在哪里可以找到它?