We have so far received atleast a couple of queries stating something like -
While using Visual Studio 2010 and having referenced Revit API in my project, I also added some web reference to the project. I notice that the build process fails and the error mentioned below is thrown:
Error 1 An attempt was made to load an assembly with an incorrect format: C:\Program Files\Autodesk\Revit Structure 2013\Program\RevitAPI.dll.
But when I try to debug, the project is working fine without any problem. How can I fix this?
The reported issue with the build error seems to be a generic issue with WebServices consumption in a .NET application with the project configured for release mode.
I found out (and tested) that under Build tab in Visual Studio project properties, you can set the Generate Serialization Assembly setting to Off (from Auto). This will disable the generation of the projectName.XMLSerializers.dll and this assembly will be generated dynamically at runtime (instead of compile time).
And this change of setting resolves the build error you have reported.
To read up more on this setting, you can find relevant information on MSDN – one such link is: