网站多语言不能在C#code使用VB.NET类 [英] Web site with multiple languages can't use VB.NET classes in C# code

查看:134
本文介绍了网站多语言不能在C#code使用VB.NET类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展为在VS 2008 VB.NET的默认语言作为我的preferred语言网站项目的一个新功能是C#创建在C#code子文件夹 APP_ code 文件夹并添加适当的 codeSubDirectories 元素web.config文件。问题是,我不能在我的C#code参考VB.NET类。所有的VB.NET类和结构都放在全局命名空间中的APP_ code。但即使我将一些VB.NET类同一个命名空间我在C#中使用了我的课,我还是不能使用它们。另外,我尝试我的课移到全局命名空间,但是这也并不能帮助我。

I'm developing a new functionality for web site project with VB.NET default language in VS 2008. As my preferred language is C# I create subfolder for C# code in the App_Code folder and add appropriate codeSubDirectories element to web.config file. The problem is that I can't refer VB.NET classes in my C# code. All VB.NET classes and structures are placed in global namespace in the App_Code. But even if I place some VB.NET class in the same namespace I've use for my classes in C#, I still can't use them. Also, I've try to move my class to global namespace but this also doesn't help me.

推荐答案

从的 codeSubDirectories

构建顺序是从codeSubDirectories收集的自上而下的顺序推断。该APP_ code目录是建最后一次。

The build order is inferred from the top-down order of the codeSubDirectories collection. The App_Code directory is built last.

这意味着当你的C#code在编译时,VB code一直没有在这一点上进行编译。你可能会尝试不同的基类,等等,并把它们在更早的子目录或为编译类库,但我可能会建议只是写您的code在VB中 - 它不是的的棘手当你已经习惯了对方一个写 - 框架仍然是框架

Which implies that when your C# code is being compiled, the VB code hasn't been compiled at that point. You might try and separate base classes, etc, and put them in an earlier subdirectory or into a compiled class library, but I'd probably recommend just writing your code in VB - it's not that tricky to write in one when you're used to the other - the framework is still the framework.

这篇关于网站多语言不能在C#code使用VB.NET类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆