Hi all,
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
the 4.0).
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?
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
library.
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!
19giugno
Member
4 Points
5 Posts
VS Command Prompt compiler options
Mar 02, 2012 01:13 PM|LINK
Hi all,
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 the 4.0).
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,
D.
Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: VS Command Prompt compiler options
Mar 05, 2012 02:47 AM|LINK
Hi
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:
http://msdn.microsoft.com/en-us/library/bb772098(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/bb398202.aspx
Hope it helpful.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
19giugno
Member
4 Points
5 Posts
Re: VS Command Prompt compiler options
Mar 05, 2012 01:23 PM|LINK
Hi Dino,
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 library.
So I am lost.
Regards,
D.
Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: VS Command Prompt compiler options
Mar 06, 2012 01:07 AM|LINK
Hi
You can compile all the class to dll without Visual studio.
In this folder:
C:\Windows\Microsoft.NET\Framework
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.
Example:
C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild D:\VSProject\ASP.NET\ClassLibrary1\ClassLibrary1.vbproj
(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.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
19giugno
Member
4 Points
5 Posts
Re: VS Command Prompt compiler options
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!
Regards,
D.