<update>

There are some things I should share with you. 

  • This was done in VS2005.
  •  I was able to do this since it was a website and not a web application.  In a web application all the code (even code behind) is complied into one assembly.
  •  Another thing to watch for when making the conversion is once you start in the App_Code folder you need to convert all the code in folder.  The code in there is compiled in one assembly and therefore can not be mixed.
I'm about 75% done the conversion if I run across anything else I will post an update.

 </update>

 

Back in highschool and college I used C/C++.  Since I have worked with VB* in the last 10 years I have kinda dwindled on my C skills.  So I decided to strart using C# (It's not C/C++ i know) instead of VB.net on my current homebrew apps.  So here is how I converted the first of my webpages (pictures.aspx) in the OurSite project I am working on.

  1. Checked the web.config to make sure C# was included as compilable language.
  2. Added Pictures.aspx.cs file
  3. Changed page directives in the Pictures.aspx
    1. Changed CodeFile to the CS page
    2. Changed Language to C#
    3. Changed AutoEventWire to true (You can add events to the actual controls and leave this set to false)
    4. Closed and reopened page
  4. Converted Code
    1. Copied VB Code to clipboard
    2. Replaced all &s with +s for string concatination in notepad++
    3. Went to: http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx (Page can go from VB to C#)
    4. Converted code
    5. Pasted new code in Pictures.aspx.cs
    6. Commented out all code in Pictures.aspx.vb
  5. The converter does not detect the difference between array parens vs method parens so I had to change a bunch to []
  6. The .ToString (and other functions) came through the converter without the parens so I had to add them

Yeah so that was it.  The code worked flawlessly.  So I can change one page at a time in my ASP project over to C# code.  Only prereq for this is VS2k5+.

 Any other ideas or better converters please let me know.

 

kick it on DotNetKicks.com