Copy 64 bit project to 32 bit project - visual-studio-2010

Is there an easy way to copy a 64 bit Visual Studio 2010 project to a 32 bit project without needing to set some properties again???
(Or even make a project that works for both 32 bit and 64 bit machines???)
See details:
I have a project I compile in 64 bits machine, and runs in 64 bits machine. (DLL for Autocad Plug in)
That DLL can work in 32 bit machines as well, but there's a problem. I do can load it in Autocad. But at any point of the code where my DLL calls a method from Autocad.Interop libraries, those methods cannot be found.
The same goes for the 32bit version trying to run in 64 bit Autocad.
So, 64 bit project only runs in 64 bit Autocad. And 32 bit project only runs in 32 bit Autocad.
That's because interop libraries are different from 64 to 32 bit Autocad applications.
I came up with a solution: create a copy project taking the 32 bit autocad.interop as reference. That compiles and runs fine. (It means I have a 32 bit reference in my machine, but it doesn't work for my 64 bit autocad)
Now, my generated 32 bit project can work in 32 machines, but not in 64.
But I need to keep copying files from the 64 project to the 32 project.
What I do is to erase and exclude all 32 files from the 32 project and replace by the 64 files. Then include again.
That would be good if I had not to set all resources to Embedded Resources again (because they are reset to Resource).
So, how can I do this in an easier way???

Related

Set app on Any CPU and compiled as 64bit if can be run in 32 and 64 bit. Visual Studio 2019

It is possibile to change compiled for 64bit if application can be run in 32 and 64 bit? From what I see now, if I run applications as Any CPU, it starts as 32 bit. This would allow me to get into 64 bit registers.
It is set to 32bit by default for historical reason. The Visual Studio team never took the time to change it. Nowadays you should stick to 64bit instead.

Using Oracle client 32 bit on Win 10 64 bit

I am using Windows 10 64 bit and Oracle client 32 bit (It's my company requirement). But when I open some existed program, it display a dialog with error:
Attempt to load oracle client libraries threw badimageformatexception.
This problem will occur when running in 64 bit mode with the 32 bit
Oracle client components installed
I had fixed by add Enviroment variables but it's not working. I am searching around Google, but the solution almost about fix on Visual Studio when developing application.
These program is existed, not run from Visual Studio.
How should I do to make application which using Oracle client 32 bit on OS 64 bit?
A 32 bit application requires also a 32 bit Oracle Client. A 64 bit application (resp. "AnyCPU" on windows 64 bit) requires a 64 bit Oracle Client.
Unless you use the ODP.NET Managed Driver (see here) there is not way to get rid of it. One solution is to install both, 32 bit and 64 bit Oracle Client, follow this instruction: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed

Registering 32 and 64 bit DLL in a single MSI using WiX

I need to create a SINGLE Windows installer that performs the following tasks when it is run on the target m/c:
Runs a service
Registers a 32 bit DLL
Stores the 32 bit and 64 bit log4cxx.dll libraries in C:\Windows\sysWoW64 folder and C:\Windows\system32
Registers a 64 bit DLL
Currently, I am using WiX to create an installer and I am at a point where I can register either 32 bit OR 64 bit installer but not both. Unfortunately, I don't have the option of separating the 32 and 64 bit installer as I need to register both the installers on a 64 bit machine.
I would like to know if there was a way to register both the DLLs in one installer. Thanks in advance.
WiX doesn't support mixed 32/64-bit packages. So the only option is using separate packages:
A 32-bit package for 32-bit systems.
A 64-bit package which installs both 32-bit and 64-bit resources on a 64-bit machine.
Another solution is to use a different setup authoring tool which supports mixed 32/64-bit packages. Perhaps this list will help: http://en.wikipedia.org/wiki/List_of_installation_software

How to create an installer condition that test for 32 and 64 bit Windows

I am creating a visual studio set-up project. I need to test to see if the version of Windows I am being installed on is 64 or 32 bit. I am planning on checking for the existence of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node as a way of telling that I am being installed on 64 bit windows. Is this a good idea and/or is there a better way?
The reason that I want to know which version of Windows I am on is so I can create a directory under either System32 or SysWOW64. I would rather not create two installers one targeting 64 bit platforms and one targeting 32 bit platforms.
The easiest way to check for a 64 bit machine in an MSI installer is to use the VersionNT64 property. This will only be set if the target machine is running a 64 bit operating system.
http://msdn.microsoft.com/en-us/library/aa372497(VS.85).aspx

System.Data.OracleClient on Windows 7 64

I'm trying to access an Oracle Database from a program I'm writing on Windows 7 64bit. Whenever it initializes the client, i get a BadImageFormatException complaining that I'm trying to use a 32bit client in a 64bit environment. I've tried to compile the program in any way (Any CPU, 32, 64 bit), but it did not solve the problem. Any help?
I would guess that the error message is correct. You have a 32 bit Oracle DLL that you use from a 64 process. The Oracle DLL probably does some interop's with native code, that may require it to be processor specific.
There are several ways to solve this.
Option 1: Get the 64 bit Oracle DLLs.
Option 2: Make sure that your process is 32 bit.
.NET exe files marked for AnyCPU will start a 64 bit process on a 64 bit operating system. But if you mark your EXE file for x86 then it should work. For Web applications you have to set a 32 bit flag somewhere in IIS.
You need to configure your Project to target the .NET 4 Framework, by going to Project-Designer -> Target Framework.
Then you need to delete the old Oracle dll, and use the new 64-Bit-Version of the Oracle dll that is included in the .NET 4 Framework.

Resources