.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

'mscorlib.dll' targets a different processor/.net calling a native dll

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
I  have a vb.net that calls a dll in native cpp.  Works fine in 32bit.  Now I want to upgrade to 64 bit.  I've done this before and it worked but now get a runtime error.  Compiles ok but with the error noted in the subject line. Also, when I try to debug, the ide tells me that it can't debug managed and native.  Yes it can, I just forgot how. platform is win7, intel 64 bit.  any suggestion to the forum/whitepaper or ideas are greatly appreciated. Thanks in advance! Robert.

View Complete Post

More Related Resource Links

Getting Warning as Error: Assembly generation -- Referenced assembly 'mscorlib.dll' targets a dif

I built a sp application on a dev environment and the code worked.  I moved the whole project to a different dev environent (i.e. differmt machine name, domain, etc), and when I try to compile, I get the above error (also, one about System.Data.dll) If I understand, it means VS 2010 is getting confused as to use the 32 bit or 64 bit GAC?  If thats true, how do I force this in vs? thanks  Rocky Sanders

Running C#/WPF app and calling native 32bit or 64bits DLL


Working on this issue, solved on paper here:


now I'm finally getting to the code, I have an issue:

when calling the native function, i get a 'unbalanced stack' error. The DLL as well as the c# are compiled to Win32, even though I run on a Win7 x64 machine, and I wonder if that would be the problem, but I still can't find how to make it work.

Ideally I want this to work in 32bits on a 32bit machine and 64bits on a 64bits machine, because the native code will be handling data that may be huge, and I don't want to be limited by using only 32bits DLLs

I understand I would need the native DLLs to be compiled in both platforms, and somehow the managed part needs to figure on what it runs to call the right DLL, and that's another question altogether. For now I'd like to figure out how to make this work in either mode (C# compile for Win32 with 32 bits DLL, and C# compiled for x64 with 64bits DLL) but this doesn't work.

I am running Win7 x64 (obviously) and that may be the issue when compiling for Win32.

Another question arises too: what if I have a 3rd party 32bit DLL I need to run? Can managed co

Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

CLR Inside Out: Best Practices For Managed And Native Code Interoperability


There are many factors to consider when building your app with both managed and native code. Find out how to employ interop and how to choose the interop that's right for you.

Jesse Kaplan

MSDN Magazine January 2009

GUI Library: Bring the Simplicity of Windows Forms to Native Apps


In this article, author John Torjo presents a guide to his C++ GUI library called eGUI++ and explains how it makes user interface programming easier.

John Torjo

MSDN Magazine June 2008

WinUnit: Simplified Unit Testing for Native C++ Applications


Maria Blees introduces WinUnit, a handy new unit testing tool for native C++ projects.

Maria Blees

MSDN Magazine February 2008

XmlLite: A Small And Fast XML Parser For Native C++


XmlLite provides a high-performance, low-overhead XML reader and writer geared for applications written in native C++. Learn more here.

Kenny Kerr

MSDN Magazine April 2007

Netting C++: Mapping Native C++ to the Common Type System


This month Stanley Lippman begins translating the Text Query Language Query class hierarchy from C++ to the .NET Common Type System.

Stanley B. Lippman

MSDN Magazine February 2007

Wrappers: Use Our ManWrap Library to Get the Best of .NET in Native C++ Code


By now you're probably used to reaching into the .NET Framework using Managed Extensions with your C++ code. But what do you do if you have legacy apps that use older versions of the compiler, or if you want to avoid some of the CLR requirements? Well, you can wrap Framework classes in a native way so you can use them in any C++/MFC app without /clr. Paul DiLascia shows you how.

Paul DiLascia

MSDN Magazine April 2005

Advanced Basics: Calling All Operators


This month I found an interesting question in my mailbag. It went something like this: "I am writing some code working with points and other drawing objects in Visual Basic® 2003, and I just want to add an offset to a point, effectively moving the point.

Ken Getz

MSDN Magazine December 2004

XML in Yukon: New Version Showcases Native XML Type and Advanced Data Handling


The next version of Microsoft SQL Server, code-named "Yukon," represents quite a few steps forward in the evolution of XML integration. Yukon supports native storage of XML data using the XML data type, which makes it possible to run native queries on XML data using the emerging industry standard XQuery language. Data integrity of the XML data type can be enforced through schema validation and XML-based check constraints, and special indexes can be defined that help speed up queries. In addition, Yukon has the built-in ability to expose its data through Web services. This article discusses these and other XML features of Yukon.

Bob Beauchemin

MSDN Magazine February 2004

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend