Asmussen
Asmussen

Reputation: 468

Converting an ASP.NET Website that has C# and VB to a Web Application

I have an ASP.NET Website project that I have converted to a Web Application. I converted the App_Code which has sub directories for vb and cs it renamed to the folder to Old_App_Code. Now the C# code will not compile, none of the syntax is recognized and several hundred errors show in the error list.

I know its possible to have both languages in a website project but how do I compile both in a web app project? or do I have to convert all the C# to VB?

Upvotes: 6

Views: 4559

Answers (1)

Teoman shipahi
Teoman shipahi

Reputation: 23042

To run C# and VB together you can do some changes in web.config such as;

<system.codedom>
<compilers>
        <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <providerOption name="CompilerVersion" value="%ASSEMBLY_VERSION%"/>
        </compiler>
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <providerOption name="CompilerVersion" value="%ASSEMBLY_VERSION%"/>
        </compiler>
    </compilers>

and

<compilation debug="true" defaultLanguage="VB">
<codeSubDirectories>
                <add directoryName="CS_Code"/>
            </codeSubDirectories>
        </compilation>

for the rest you you use this walktrough

https://stackoverflow.com/a/735062/929902

Upvotes: 7

Related Questions