我想在VS2010,4.0框架中調試現有的應用程序。我得到這個編譯時錯誤:C#預處理器指令(#if和#endif)不起作用。編譯錯誤
"The name 'b_resources' does not exist in the current context" .
我看不出什麼錯在下面的代碼:
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Drawing;
#if TR
using b_resources = Common.Resources.TResources;
#endif
#if EN
using b_resources = Common.Resources.EnResources;
#endif
namespace Common
{
public static class BResources
{
public static string caption { get { return b_resources.ProductName; } }
public static string company_name { get { return b_resources.CompanyName; } }
}
}
TResources
和EnResources
是資源文件(的.resx)
我錯過了一些有關.Net的參考?
大概估計既沒有'TR'也沒有'EN'被定義...這並不是你通常做全球化的方式。你不建立單獨的版本 - 你建立*一個*版本,在執行時加載適當的資源。 –