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

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

EXE in 32bit and DLL compiled for anyCPU

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :WPF

Our application is one EXE and multiple DLL's. Right now, we are compiling all of them for x86 so we are forcing 32bit because the running size of the application is a lot smaller (memory usage).

If we compile the EXE as x86 and the DLL's as anyCPU, on a 64bit machine will the DLL's be 32bit or 64bit?

the reason for my question is if i can compile the DLL's for anyCPU and then have two EXE's, one for 32bit and one for 64bit, then i have only one duplicate program for the 32 or 64 bit change, and if a user wants to run full 64bit they only need to run the 64bit EXE and everything is fine. But if a user is on a 64bit machine but wants to run in 32bit mode, they would run the 32bit EXE.

Let me know if this is true. i can't test this as i develop on a 32bit XP machine.



View Complete Post

More Related Resource Links

Web Deployment Project - "has not been pre-compiled"


I have created a Team Build that builds a solution containing a Web site, multiple class libraries (project references to the Web site) along with other compiled references, and a Web Deployment Project (WDP).  Everything is working well except when I deploy (either via Team Build or the WDP).  The deployed directory structure looks correct, but when I navigate to the first page I receive "The file '/WhatSite/FirstPage.aspx' has not been pre-compiled, and cannot be requested."

Here's the kicker:  When I set the WDP's Output Assemblies property to "Merge all outputs to a single assembly" and deploy, the default page returns the error above.  When I set the Output Assemblies to "Merge each individual folder output to its own assembly" and deploy, the default page loads correctly but all subsequent pages return the error. 

If I go back to the plain Publish Web Site under the Build menu, the site works as expected.

What am I missing or does anyone have any ideas?


CorBindToCurrentRuntime failed when C++ Project compiled using VS2005

Hi, I use unmanaged CLR Hosting APIs for loading CLR in windows native apps like notepad, calc etc. In case CLR is already hosted in the application ( like any .NET app ) I used CorBindToCurrentRuntime function published by mscoree.dll to get the handle to ICorRuntimeHost object and do some stuff by enumerating AppDomains. Things were working fine until I migrated my project from VS2003 to VS2005 IDE. I had to do this I faced some issues with my existing code when tried to get handle to Runtimehost using existing hosting APIs in CLR 4 process. I decided to check if new API i.e. "CLRCreateInstance" is exposed by mscoree.dll then use it to get handle to ICorRuntimeHost else use old function. In order to use this I included metahost.h file in my project and build my application. Now, for some reason I'm not able to get handle to ICorRuntimeHost interface inside .NET 1.1 application. If I use polcy file to run .NET 1.1 app as part of .NET 2.0 CLR, then call to "CorBindToCurrentRuntime"succeed and return the correct handle. Can anyone suggest what could possibly go wrong if I migrate from VS2003 to VS2005 IDE. I thought if it could be because of some .net framework dependeny  introduced when I built my c++/native project using VS2005, but I could not find one. My C++ project is a native project and doesn't depend on clr. Code Used to get

C# target 32bit and 64bit desktops with SMO included

I have an application that uses three SQL 2008 R2 SMO assemblies.  I need to target 32 and 64 bit machines that are running either 32 or 64 bit versions of SQL 2008.  I have no idea how to handle an Any CPU build for the application.  Since the SMO assemblies are either 32 bit or 64 bit, do I have to create a 64 bit build of my app and also a 32 bit build of my app.  I have no idea how to proceed with the build at this point.  This is my first app to support 64 bit machines and servers; I have only had to work in 32 bit in the past. Also, I do not know where the best forum for this question would be.  It is not a SQL question unless the answer is in the SQL assemblies.  I am developing on 64 bit Win 7 with VS 2010 and .Net 4. The C# app is wpf. The application needs to run on 32  and 64 bit Vista machines with 32 and 64 bit SQLExpress 2008 instances, and it also needs to run on 2003 and 2008 32 and 64 bit servers running 32 and 64 bit SQL 2008 servers. Any help would be appreciated.  I expect that I don't know what I don't know on compiling apps and including assemblies in an Any CPU world. Thanks, LD

SharePoint 64bit + 32bit Office JET Drivers?

Hi Guys, I'm in a bit of a pickle here! I have a document library which contains Excel files on Moss 2007 (64bit). When a file gets upload to the library, a workflow kicks off with some custom activities I've wrote in C#. One of the activities opens the SPFile object (the Excel data) for the SPListItem object thats currently been added. It dumps the stream to a temp file on the hdd (a random .xslx file) and attempts to open it.... but i get this error:   The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.   So i dig about a bit and it turns out there is no 64bit jet drivers for windows 64bit. If i compile my activity to 32bit, it doesnt seem to be able to interface with the 64bit installation of sharepoint!!   What can i do to get round this?!   Many thanks! Will

deployment error on x64 when compiled as x64

I have a service application that I compile as x86, x64, and any CPU.  It installs correctly on x86 using either x86 or any cpu.  It installs correctly on x64 if I compile as x86 or any CPU but if I include the wrong DLL the any CPU version crashes so I have to be careful where the any CPU version is installed.  If I compile the x64 it gives me a BadimageForamtException during install. I would prefer to only have the two installs x64 and x86 which limits the odd errors when using the any CPU version but I need to resolve the BadimageForamtException first. I know the problem is more than likely one of the related DLL is 32 bit only my problem is finding it.  Is there a quick way of determining if a DLL is 32 or 64 bit?  It would be nice if this detail was displayed in the list of properties in VS when you click on the references. John J. Hughes www.functioninternational.com/

How do I make changes in a website that has been partly pre-compiled

 I have been asked to make some changes to a website developed by someone else and it has a lot of unfamiliar stuff going on. In the first place, the website has some strange file types: csproj, csproj.user and .designer.cs. Second, there is a folder under the root folder called Datalayer. I have been making changes to code in files in this folder, but my changes are not being implemented when I build and run the website. Instead, it seems to be using some pre-compiled version of these. Many of the aspx.cs pages have a line at the top: using OceanLED.DataLayer; There is also a /bin folder under the root folder, which contains a .dll file and a .pdb file for the website. There is also a /obj/debug folder, also containing a .dll file and a .pdb file for the site. Finally, when I try to build, I get loads of these cryptic warning messages: Warning 1 The type 'OceanLED.DataLayer.WarrantyClaim' in 'C:\Inetpub\wwwroot\OceanLED\DataLayer\WarrantyClaim.cs' conflicts with the imported type 'OceanLED.DataLayer.WarrantyClaim' in 'C:\Inetpub\wwwroot\OceanLED\Bin\OceanLED.dll'. Using the type defined in 'C:\Inetpub\wwwroot\OceanLED\DataLayer\WarrantyClaim.cs'. C:\Inetpub\wwwroot\OceanLED\DataLayer\WarrantyClaim.cs 287 17 C:\...\OceanLED\ How do I get it to use MY code.

Reference a assembly compiled against .NET 4 CLR from a .NET 2 CLR

Hi, I just read this aricle http://msdn.microsoft.com/en-us/magazine/ee819091.aspx. In Figure 2 (Will These Runtimes Load in the Same Process?) You can read that it is OK to load an assembly compiled against .NET 4 CLR from an application compiled against .NET 2 CLR. But later in the aricle under "Library Developers and Consumers " you can read that it will not work for libraries. I have a web application (ASP.NET) compiled against .NET 2 CLR that needs to reference an assembly compiled against .NET 4 CLR. Will this work or not? I have tried it several times and it works fine. I don't understand the text in the aricle becase Figure 2 says it's OK but the text under "Library Developers" says it will not be OK. But for me it works. Maybe I have just had luck?

Problem consuming 32bit WCF service which references a native Dll in a 64 bit OS(Windows Server 2008

I have some 32bit Dlls which i want to use it in 64bit OS as i do not have a source code of this to recompile it for 64 bit OS. I have created a x86(32 Bit) WCF service which calls these Dlls and hosted it as a Windows Service on a x64(64 Bit) machine using Windows Server 2008. I have created one more x64 client which calls a function in the WCF which in turn calls a function from the 32 bit native Dll. Whenever i try calling this WCF from the client I get an error as given below.Can anybody please guide as to where I am going wrong and what is needed to solve this issue. Thanks in advance for any help.******The Error Message********************System.BadImageFormatException: Could not load file or assembly 'TestWCFWrapper, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.File name: 'TestWCFWrapper, Version=, Culture=neutral, PublicKeyToken=null'   at TestWrapperWCFClient.Form2.button1_Click(Object sender, EventArgs e)   at System.Windows.Forms.Control.OnClick(EventArgs e)   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)   at System.Windows.Forms.Control.WndProc(Message& m)   at System.Windows.Forms

COM Server process compiled with /clr option doesn't unload itself from memory when last COM client

I created Visual C++ ATL project in VS2010, exe type, imlemented COM object, then added /clr option to project. Project uses other C# dlls (WCF service). When last COM client disconnects and last COM object instance destroys, WCF service stopped, my COM server process doesn't unload itself from memory. All managed threads in C# dll are background, COM object doesn't create threads. How can I unload server process? Thank you in advance. 

Host server says my uploaded files are not compiled

I recently published my website locally and then uploaded the .aspx files to the root directory of the host server and then uploaded all of the compiled files into a new "bin" subdirectory.  But, when I accessed my website through my domain name, I got an error message that said that my Default web page has not been compiled.The service that I am using is an ASP.NET hosted server called JodoHost.  They recommend that I contact you for help with this problem.  But I noticed that, besides the new "bin" subdirectory that I put all of my compiled files into, there was also subdirectories named aspnet_client, cgi-bin, and images.  I assume that my problem stems from not placing my compiled files into these.  Is this correct?  If so, what should I be placing into which directories?Maurice

Project publishing as a compiled package (DLL+aspx). Can I revert to aspx and editable pages?


First time 4.0, the project is a complied DLL - is there any way to revert to just normal aspx and editable cs?



ManagedSpyLib.dll compiled for .NET 4.0 ??

 Is there a version of ManagedSpyLib.dll compiled for .NET 4.0 ?? 

I have the C++ Express version but cannot compile it since I don't have the correct include files.



Tom Fisher

ASP.NET that access a 32bit dll


Hi Guys,


I've got a ASP.NET site that uses a third party dll (not a com component) which is works fine on my test server which is 32bit

but not on our live server which is running 64bit. I cannot recompile the dll as I don't have the code, so I am looking for a way 

that will allow my site to access the dll when need on 64bit server.


P.s. I cannot recompile the dll (3rd Party)

Setup error installing "SQL Server 2008 Developer" on Windows7 (32bit)

I had downloaded SQL Server 2008 Developer from DREAMSPARK.
When i ran the setup, a dialog box said, it has known compatibilty issues and that i'll have to run Service Pack 1 or above, after completing the installation and before running the software.


But the installation doesnt proceed AT ALL when i click Run Program....
It gives the following error:

TITLE: SQL Server Setup failure.

SQL Server Setup has encountered the following error:

Invoke or BeginInvoke cannot be called on a control until the window handle has been created..



Is there a way around this problem???
If so, please gimme a solution asap, as i need to use the software for my project.

ODBC 32bit is launching 64bit ODBC administrator. No menu opens 32bit.

In Windows 7 maybe all 64bit OS's are setup for 2 different types of ODBC connections.  Try running these and adding your connection in one or the other.
I have not found the navigation for each version as the control panel I think uses 64bit even the one marked 32bit seems to be pointing to 64bit.  There is no visual key that tells you which one you are using.  If you add a key called 64bit and then click the 32bit icon you still see the 64bit.  Most applications will use the 32bit ODBC so you will have to manually navigate to add connections.
To setup an ODBC link for 32bit application you must use
To setup an ODBC link for 64bit application you must use

My question is why does the 32bit icon point to the wrong one?  Is there a KB or update for this?

Cannot launch application compiled in Visual Studio 2010


Hi all,

I have compiled and created an .msi file to install a WPF desktop application.

It installs fine but will not launch. The error is below.

The instllation machine is running windows 7, 32bit. Could it be that I am compiling a 64bit application. If so how do i change this in VS?

Cheers, Shane

Error Log:


Application: DTFStampingClient.DTFDesktop.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.Reflection.TargetInvocationException


at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)

at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)

at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)

at System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext)

at System.Windows.Application.LoadComponent(System.Uri, Boolean)

at System.Windows.Application.DoStartup()

at System.Windows.Applicati

Using 32 or 64-bit DLL with AnyCPU DLL

Hi All,

First of all, I'm sorry if it is not the right place for this question... It was the one I though was the most appropriate.

I have a 3rd party DLL that has two versions, a 32 and a 64-bit version.

I was wondering if I could create an AnyCPU DLL that would use both versions depending on the context.

If I am in a x64 environment, I would have the two versions put in the GAC (GAC_32 and GAC_64) and my DLL put in the GAC_MSIL. Now, if I launch my DLL using a 32-bit program, will the dependency will be resolved with the 32-bit DLL? And if I launch my DLL using a 64-bit program, will the dependency will be resolved with the 64-bit DLL?

I hope this is clear enough...

Thank you,

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