Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 06, 2012 07:39 AM by 19giugno
Mar 02, 2012 01:13 PM|LINK
I have built a web site that is using an URLRewrite module I wrote. The module is a vb class file compiled in a dll, when was developing using VS 2005 and the 2.0 .Net framework. Now I am using VS 2010 and the 3.5 framework (my hosting provider does not support
I cannot make any change to the vb file, because whenever I compile the vb into the dll using the VBC command, the dll is compiled with the framework 4.0 and I get the "System.BadImageFormatException" error message.
My only chance is to compile the vb file using the VS2005 VBC command prompt from another computer and put bacj the dll into my Bin folder.
How can I solve this issue? How can I compile, with the VBC command prompt, targeting a different framework?
Thanks and regards,
Mar 05, 2012 02:47 AM|LINK
VS 2010 default target to .NET 4.0, you can integrate .NET 3.5 to 4.0 but you can't integrate 4.0 to 3.5.
I think in VS 2010 you can compile the project to .NET 3.5 dll.
in this way:
Hope it helpful.
Mar 05, 2012 01:23 PM|LINK
thank you very much for the reply, but I could not make it work. Surely because I am not that expert.
The thing is that, that DLL needs to be compiled separately from the project, as it is being referenced by the web config file, so needs to be in the proper folder before everything else. I used to compile it using the VS VBC command prompt with VS2005. I have
tried to do the same with VS2010, but I think VBC 2010 only compiles using the 4.0 framework.
I have then created a separated VS2010 project, including only the VB class that generates the DLL, changed the target framework to 3.5, compiled and moved the DLL from this latter project to the main one, bin folder. It did not work. It could not load the
So I am lost.
Mar 06, 2012 01:07 AM|LINK
You can compile all the class to dll without Visual studio.
In this folder:
You can find all the .net framework version. include v3.5.(if you installed vs2010 it will have )
Use CMD.exe to excute
MSBuild+ your project file.
(You can use notepad open the .csproj file and change all 4.0 to 3.5)
Also if only one class you can use C:\Windows\Microsoft.NET\Framework\v3.5\vbc.exe D:\....class path....
If you don't have v3.5 folder you can install a .NET 3.5 framework.
Mar 06, 2012 07:39 AM|LINK
Dino... you saved my life! I can use the vbc from the 3.5 folder! Thank you so much! I still do not understand whether I should use the 32bit version or the 64bit, but thanks, you solved my issue!