开发者

Mixed Language Woes in Visual Studio 2008

I'm trying to figure out how to get mixed-language support working in Visual Studio 2008. In my app_code folder, I've created two subfolders (CS, VB), and added the following to the web.config file:

<compilation>
  <codeSubDirectorie开发者_StackOverflow社区s>
    <add directoryName="VB" />
    <add directoryName="CS" />
  </codeSubDirectories>
</compilation>

The main application is a VB.NET Web application (with a .vbproj file).

Any time I attempt to open a C# file from the app_code\cs folder, it treats the file as Visual Basic for compilation and syntax checking purposes. It still tries to build the classes in the CS folder as though they were Visual Basic. (The extension on these classes is, indeed, .cs.)

Any help figuring this out would be greatly appreciated.


I think the language is defined at the project level. You could always put your C# files into a separate C# class library project and then reference that project from your web application in Visual Studio.


As already stated in the comments, you are using a Web Site project instead of a Web Application project. The Web Site project is there for backwards compatibility and should not be used for new application development.

If you use a Web Application you can mix and match .cs & .vb class files in the project. No configuration is necessary.

http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx#wapp_topic5

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜