简体   繁体   English

C# 错误:错误 CS0246 找不到类型或命名空间名称“”(您是否缺少 using 指令或程序集引用?)

[英]C# Error: Error CS0246 The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)

I have an application which suppports both UWP and .NET.我有一个支持 UWP 和 .NET 的应用程序。 I have a namespace test which is .net specific.我有一个特定于 .net 的命名空间测试。 So I have included it conditional like所以我有条件地把它包括在内

#if! WINDOWS_UWP
using test;
#endif

test contain classes mytest,mytest1,mytest2.测试包含类 mytest、mytest1、mytest2。 But only one is showing up when I tried test dot.但是当我尝试测试点时,只有一个出现。

#if! WINDOWS_UWP
mytest obj = new mytest();
#endif

showing error:"Error CS0246 The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)"显示错误:“错误 CS0246 找不到类型或命名空间名称''(您是否缺少 using 指令或程序集引用?)”

When I tried the same in a sample .net application, all classes are showing up when I used test dot.当我在示例 .net 应用程序中尝试相同时,当我使用测试点时,所有类都显示出来。 test comes from a nuget package.测试来自 nuget package。

Please help.请帮忙。

Thanks,谢谢,

is test supposed to be #included ? test应该是#included吗? ie IE

#if! WINDOWS_UWP
#include "mytest.cs"

mytest obj = new mytest();

#endif

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C# 错误 CS0246 找不到类型或命名空间名称“Socket”(您是否缺少 using 指令或程序集引用) - C# error CS0246 The type or namespace name 'Socket' could not be found (are you missing a using directive or an assembly reference) 错误 CS0246:找不到类型或命名空间名称“Npgsql”(您是否缺少 using 指令或程序集引用?) - error CS0246: The type or namespace name 'Npgsql' could not be found (are you missing a using directive or an assembly reference?) 错误CS0246找不到类型或名称空间名称“ Windows”(是否缺少using指令或程序集引用?) - Error CS0246 The type or namespace name 'Windows' could not be found (are you missing a using directive or an assembly reference?) 错误 CS0246:找不到类型或命名空间名称“StreamingContext”(是否缺少 using 指令或程序集引用?) - Error CS0246: The type or namespace name 'StreamingContext' could not be found (are you missing a using directive or an assembly reference?) 错误 CS0246:找不到类型或命名空间名称“IWebHostEnvironment”(您是否缺少 using 指令或程序集引用?) - error CS0246: The type or namespace name 'IWebHostEnvironment' could not be found (are you missing a using directive or an assembly reference?) 错误 CS0246:找不到类型或命名空间名称“BannerPosition”是否缺少 using 指令或程序集引用? - error CS0246: The type or namespace name 'BannerPosition' could not be found are you missing a using directive or an assembly reference? 错误 CS0246 找不到类型或命名空间名称“CreateRandomAnswersForKey”(您是否缺少 using 指令或程序集引用?)? - Error CS0246 The type or namespace name 'CreateRandomAnswersForKey' could not be found (are you missing a using directive or an assembly reference?)? CS0246:找不到类型或名称空间名称“ T”。 您是否缺少using指令或程序集引用? 在C#中 - CS0246: The type or namespace name `T' could not be found. Are you missing a using directive or an assembly reference? in c# CS0246 C#找不到类型或名称空间名称“ ForeignKeyAttribute”(是否缺少using指令或程序集引用?) - CS0246 C# The type or namespace name 'ForeignKeyAttribute' could not be found (are you missing a using directive or an assembly reference?) 错误CS0246找不到类型或名称空间名称“ Write_To_Console_dr”(您是否缺少using指令或程序集引用 - Error CS0246 The type or namespace name 'Write_To_Console_dr' could not be found (are you missing a using directive or an assembly reference
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM