The default working environment of Visual Studio seems to be 32 bits. And I need to run one of my applications in 64 bit mode. I changed the project property, like "Target Platform", to 64 bits. But now I can not start my application. I got an error, for example: "Failed to load the file or assembly" My project "or one of its dependencies. An attempt was made to load the program with the wrong format."
Then I tried a new empty WebApplication. However, the same error is also shown there. I delete all the dll reference files and add the dependencies from this path "C: \ Windows \ Microsoft.NET \ Framework64". But unfortunately, so far I am getting the same error.
I changed the Application Pool property of my IIS (Enable 32-Bit Application = True). Then I tried to start the local IIS web server, but that didn't work either.
I am using Windows 7, 64-bit OS and Visual Studio 2010. And when using the following C # code to find the working environment
using (RegistryKey registryKey =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\R-core\R"))
{
var envPath = Environment.GetEnvironmentVariable("PATH");
string rBinPath = (string)registryKey.GetValue("InstallPath");
string rVersion = (string)registryKey.GetValue("Current Version");
rBinPath = System.Environment.Is64BitProcess
? rBinPath + "\\bin\\x64" :rBinPath + "\\bin\\i386";
Environment.SetEnvironmentVariable(
"PATH",
envPath + Path.PathSeparator + rBinPath);
}
The value of System.Environment.Is64BitProcess is always false. I did not want to follow the 64-bit path if the working environment is 32 bits. So, how to make VS work in 64 bit mode?
Here I posted the error message page I received. Please help me solve this problem. Thank.

source
share