0

I have vb.net windows form application(.net 4.5), I have recently added a c# based class library project in the solution and one of the vb.net projects is referencing this project. When i build the solution in Debug any cpu mode everything works fine but when i build it in release any cpu mode I get the following exception

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

Any help would be appreciated.

Thanks

sagar
  • 177
  • 3
  • 19
  • Check http://stackoverflow.com/questions/8996653/troubleshooting-badimageformatexception or http://stackoverflow.com/questions/4340362/system-badimageformatexception-an-attempt-was-made-to-load-a-program-with-an-inc. Check your build configuration for Release. – Vojtěch Dohnal Aug 18 '14 at 09:43
  • My build configuration i.e the main solution build configuration is release any cpu and the tag writer project is also on release any cpu. I have checked all the configurations all are on the same configuration – sagar Aug 18 '14 at 10:21
  • Maybe delete `bin` folder, restart VS, try to rebuild? It is very probably not connected with mixing C# and VB.NET. The error comes during build or when you execute your app? – Vojtěch Dohnal Aug 18 '14 at 11:50
  • The solution build configuration name "AnyCPU" is completely meaningless to a VB.NET project. Only the jitter forcing matters. Which you surely forgot to change for the Release configuration. Right-click the project, Properties, Compile tab. – Hans Passant Aug 18 '14 at 12:13
  • .. > Advanced Compile Options > Target CPU to "AnyCPU". For C# it is Build tab > Platform Target. I can see "Any CPU" option there, so please @HansPassant what do you mean by saying that it is meaningless? – Vojtěch Dohnal Aug 18 '14 at 18:27

0 Answers0