How to compile x64 asp.net website? RRS feed

  • Question

  • User461235248 posted

    I'm trying to compile (using Visual Studio) an ASP.Net website with the Chilkat library. The compilation fails due to this error:

    Could not load file or assembly 'ChilkatDotNet2, Version=, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    I've been told that this error occurs because of platform noncompliance.

    The weird thing is that although the compilation fails, the site works once accessed from a browser. My theory is that the IIS compilation uses csc.exe compiler from the Framework64 (64 bit) folder while the Visual Studio uses csc.exe compiler from the Framework (32 bit) folder. If this is acually it, how can I configure my Visual studio to run with the 64 bit compiler for ASP.Net sites?

    This is my current development configuration:

    • Windows 7 (x64).
    • Visual Studio 2008 Pro (x86 of course...).
    • Chilkat library (x64)
    • IIS/Asp.net (x64).
    Thursday, April 8, 2010 1:38 AM

All replies

  • User1763172376 posted

    here some links , i found






    Thursday, April 8, 2010 6:16 AM
  • User461235248 posted

    This is not my DLL, I can't decide how to compile it. Thus, these links are not really helping me.

    Wednesday, April 14, 2010 7:09 PM
  • User470413944 posted


    You can try to set the build settings by Build -> Configuration Manager -> your project -> Platform x64.

    By the way, is the third-party DLL 32bit or 64bit?

    I'm looking forward for your test result.

    Thursday, April 15, 2010 5:38 AM
  • User461235248 posted

    The DLL is 64bit.

    It appears that it's not possible to change the platform of IIS Web Projects, I can only choose "Any CPU".

    Thursday, April 15, 2010 6:13 AM
  • User-1127374575 posted

    Although this is an old thread, I decided to answer here, because it's one of the few posts you find to this problem with Google.

    I also have the problem, that my IIS websites does not compile with Visual Studio 2010 with references to 64 bit dll's, even if the option "Enable 32 Bit Applications" in the application pool is set to false.
    Also I have tried to unregister ASP.Net from the 32 bit .Net folders with "aspnet_regiis -u" and register only the 64 bit version with "aspnet_regiis -i" from the Framework64 folders.

    Nothing solves the problem and nowhere you can set which compiler the studio or IIS should use to compile the web site. At least I haven't found any option and not any hint in the internet.

    So my bypassing solution I have done, which works, is the following:
    * I have disabled building the website in the Configuration Manager of the solution
    * I have created a new project (of type Class Library), which contains no code, but a prebuild event which calls a batch file with the following command:
        c:\Windows\Microsoft.Net\Framework64\v4.0.30319\aspnet_compiler -v /VirtualPath

    Where "VirtualPath" is the virtual path of your website to compile.

    With this bypass solution the website is compiled with "real" 64 bit every time I click on "Build solution". With this solution no error comes up regarding the 64 bit references, that it is a bad format.

    But surely this is not a good solution. It's just a compromise.

    In fact it seems that Visual Studio or IIS combined with Visual Studio (regarding other resources on the net, the IIS compiles websites, not the Studio) does really use the wrong compiler, because it realy does not allow to use 64bit only dll's!
    Everywhere on the net you can find how to enable 32 bit applications in a 64 bit system, but nowhere you can find how to use a real 64 bit system.. at least I haven't found.

    If anyone has a tip how to configure the Studio/IIS in a way, that it uses the correct 64 bit compiler (or options), I would be really glad, because my current bypass solution has some disadvantages, like that it is slower than the normal build (normally not every page will be built, if nothing has been changed), it does not compile if you say "Build web site" and it does not work with the Publish function! And also displaying errors does not work in a optimal way, even if it does work for principal.

    Thursday, April 11, 2013 9:56 AM