Website Visual Studio compile fails in TeamCity with 64bit Oracle dll
We've converted an ASP.NET website from 32bit to 64bit mode.
We had to switched from the 32bit Oracle.DataAccess.dll to the 64bit version.
There are several DLLs in the solution that have this dependency.
The solution builds fine with Visual Studio 2015 both locally and on the agent machine.
The TeamCity build fails when building the website.
All of the DLLs build successfully then the website compilation fails with the error:
[AspNetCompiler] ASPNETCOMPILER error ASPCONFIG: Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.
This is the typical error that occurs when there is an architecture mismatch 32bit vs 64bit.
All projects in the build are set to ANYCPU.
The build step is configured as follows:

We are using TeamCity Enterprise 10.0.1 (build 42078)
Do I need a command line parameter? Is there a way to force the aspnet_compiler.exe to use AnyCPU or 64bit mode?
Should I switch to MSBuild runner?
Please sign in to leave a comment.
Hello,
Were you able to resolve the issue? If no, please attach full build log to the ticket you created in our support system.
Thank you!
I've found a workaround/solution for this problem.
I tried setting all projects to Release/x64 (and also tried Release/Any CPU) and I had the same problem.
The problem is that the 32bit version of aspnet_compiler.exe is called no matter how you set the platform.
[AspNetCompiler] C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /ACES2 -p wwwroot\ACES2\ -u -f PrecompiledWeb\ACES2\
Note that the 64bit version is located here: "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe"
I'm not sure if this is something that TeamCity can control or this is controlled internally by the VisualStudio solution.
To be clear - our project is a web site and not a web application. (I suspect that a web application would probably have no problems.)
The workaround is to register both the 32 and 64 bit versions of the problematic dependency dll, Oracle.DataAccess.dll, into the GAC using gacutil.exe. Next prevent this DLL from physically being copied to the website bin folder. In the VisualStudio solution, set all references to this DLL in each project so COPY LOCAL = FALSE. Remove the reference completely from the web site. Now each build project will load up the correct version (either 32 or 64bit) from the GAC. TeamCity completes the build using this configuration.