Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

asp.net

vb.net

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?

like image 753
Asmussen Avatar asked Mar 29 '13 21:03

Asmussen


People also ask

Can you make a web app with C#?

In the Create a new project window, select C# from the Language list. Next, select Windows from the platform list, and Web from the project types list. After you apply the language, platform, and project type filters, select the ASP.NET Core Web App template, and then select Next.

How can I Precompile a web app?

The compilation tool provides two general forms of compilation: in-place precompilation and precompilation for deployment. With in-place precompilation you run the aspnet_compiler.exe tool from the command-line and specify the path to the virtual directory or physical path of a website that resides on your computer.

Is C sharp and ASP.NET same?

The DifferenceC# is actually a language used in conjunction with ASP.NET. ASP.NET is more comparable to Django or Ruby on Rails . And so, basically, the difference is that ASP.NET is a framework for websites, and C# is a programming language used on this framework.


1 Answers

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

like image 119
Teoman shipahi Avatar answered Oct 01 '22 23:10

Teoman shipahi