[英]C# Winforms The type or namespace name 'Properties' could not be found in the global namespace
每當我嘗試構建或打開表單設計器文件時,我都會收到錯誤CS0400: The type or namespace name 'Properties' could not be found in the global namespace (are you missing an assembly reference?)
資源文件具有正確的命名空間. 屬性文件夾確實存在。 Visual Studio 在嘗試使用屬性文件時沒有發現任何錯誤,除非項目運行時拋出異常,因為它無法在存在的屬性文件中找到圖像。
屬性文件: https://github.com/Soniczac7/Download-Manager/blob/master/Properties/Resources.resx
示例設計器文件: https://github.com/Soniczac7/Download-Manager/blob/master/WebViewWindow.Designer.cs
任何幫助,將不勝感激。
我通過將代碼從global::Properties.Resources
更改為global::DownloadManager.Properties.Resources
並修復了 triyign 上的異常以加載我必須將字符串“Properties.Resources”更改為“下載管理器.屬性.資源”。
前:
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
后:
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DownloadManager.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
之后,任何資源異常都停止了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.