Was looking for some approaches to incrementally converting an large existing ASP.NET VB.NET project to C# while still being able to deploy it as a single web application (currently deployed on a weekly basis).
My thoughts were to just create a new C# ASP.NET project and slowly move pages over, but I've never attempted to do this and somehow merge it with another ASP.NET project during deployment.
(Clarification: Large ASP.NET VB.NET projects are absolute dogs in the VS IDE...)
Any thoughts?
Code Converter (VB - C#)Adds context menu items to convert projects/files between VB.NET and C#. Flexible: Convert a small selection, or a whole solution in one go, in either direction.
You can not mix vb and c# within the same project - if you notice in visual studio the project files are either . vbproj or . csproj. You can within a solution - have 1 proj in vb and 1 in c#.
Yes, you can use it. If you compile the VB project to a class library (dll) you can reference that library in your C# project. In order to access the types and their members from the C# project, they must be defined as public.
Start with the business logic and work your way out to the pages. Encapsulate everything you can into C# libraries that you can add as references to the VB.NET site.
Once you've got all of your backend ported over and tested, you can start doing individual pages, though I would suggest that you not roll out until you've completed all of the conversion.
You are allowed to keep your App_Code Directory with both VB code and C# code in it. So effectively, you could do it very slowly when you have the spare time to convert it.
I currently have both VB.Net and C# code in my App_Code directory and on my spare time I convert to VB.Net code or anytime I have to go back to a page with VB.Net and mess with it I convert it to C#.
Easy Peasy and Microsoft made it even nicer when they allowed you to have both VB.NET and C# on the same app. That was one of the best ideas they could have implemented in the entire app making process.
If you want to add both code directories in your one directory add this to your Web.config
<compilation>
<codeSubDirectories>
<add directoryName="VB_Code"/>
<add directoryName="CS_Code"/>
</codeSubDirectories>
</compilation>
And then add a folder named VB_Code and another folder named CS_Code in your App_Code directory. Then throw all you vb/C# code in your folders and your good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With