It seems the default running environment of Visual Studio is 32 bit. And I need to run one of my application in 64 bit mode. I did the change in project property like 'Platform Target' to 64 bit. But now am not able to run my application. I got an error like "Could not load file or assembly 'MyProject' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Then I tried with a new blank WebApplication. Still in there also showing the same error. I remove all the reference dll files and added the dependencies from this path "C:\Windows\Microsoft.NET\Framework64". But unfortunately Still am getting same error.
I changed the Application Pool property of my IIS (Enable 32-Bit Application = True). Then tried to run in Local IIS Web Server but that too didn't worked.
Am using Windows 7, 64 bit OS and Visual Studio 2010. And when using the following c# code to find the running 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 didn't want to follow the 64 bit path, if the running environment is 32 bit. So how to force VS to run in 64 bit mode?
Here I shared the error response page I got. Please help me to solve this issue Thank you.
