简体   繁体   English

C ++ / CLI CS0246:找不到类型或名称空间名称“包装器”

[英]C++/CLI CS0246: The type or namespace name 'Wrapper' could not be found

I am encountering an issue that seems identical to this one . 我遇到的问题似乎与相同。

I have a VS 2008 solution that includes, among other things: (names changed for simplicity) 我有一个VS 2008解决方案,其中包括:(为简单起见,更改了名称)

  • DLL A: A native C++, business logic DLL DLL A:本机C ++,业务逻辑DLL
  • DLL B: A C++/CLI wrapper for DLL A with a namespace of "Wrapper" DLL B:DLL A的C ++ / CLI包装器,名称空间为“包装器”
  • EXE: AC# WinForms GUI EXE project that (references DLL B) EXE:AC#WinForms GUI EXE项目(引用DLL B)

When I build the EXE, VS gives me an error: 当我生成EXE时,VS给我一个错误:

error CS0246: The type or namespace name 'Wrapper' could not be found (are you missing a using directive or an assembly reference?)

However: 然而:

The first linked question mentions something about a "duplicate definition of a compiler symbol", but I'm not sure what to look for in that sense. 第一个链接的问题提到了有关“编译器符号的重复定义”的内容,但是我不确定从这个意义上看要寻找什么。

Any ideas for what to try? 有什么想法可以尝试吗?

I think I figured this out. 我想我明白了。

Some more background: before building, the entire solution is created using CMake. 更多背景知识:在构建之前,将使用CMake创建整个解决方案。 I use CMake to make some edits to the csproj file for the EXE to point it to the correct references, including DLL B. 我使用CMake对EXE的csproj文件进行一些编辑,以使其指向正确的引用,包括DLLB。

Whenever I run CMake, the statically defined GUID for DLL B in the ProjectReference node of the csproj file gets out of sync with the newly generated GUID for the vcproj that outputs DLL B. This GUID mismatch causes DLL B not to be referenced at build time , even though it shows up in the list of references and there are no related warnings or errors. 每当我运行CMake时,csproj文件的ProjectReference节点中DLL B的静态定义的GUID与输出DLL B的vcproj的新生成的GUID不同步。此GUID不匹配会导致在构建时不引用DLL B ,即使它显示在参考列表中,也没有相关的警告或错误。

The way I discovered this was by looking at the build output. 我发现此问题的方法是查看构建输出。 In the call to csc.exe, there was no '/reference' entry for DLL B. 在对csc.exe的调用中,DLL B没有“ /引用”条目。

Now I need to find a way to keep these GUIDs in sync! 现在,我需要找到一种方法来使这些GUID保持同步!

暂无
暂无

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

相关问题 错误 CS0246:找不到类型或命名空间名称“IApplicationBuilderExtensions” - error CS0246: The type or namespace name 'IApplicationBuilderExtensions' could not be found 错误 CS0246:找不到类型或命名空间名称“PlayerMotor” - error CS0246: The type or namespace name 'PlayerMotor' could not be found 错误CS0246:找不到类型或名称空间名称“ HtmlAgilityPack” - Error CS0246: The type or namespace name `HtmlAgilityPack' could not be found 错误 CS0246:找不到类型或命名空间名称“UnityEngine” - error CS0246: The type or namespace name 'UnityEngine' could not be found 错误 CS0246:找不到类型或命名空间名称“KustoConnectionStringBuilder” - error CS0246: The type or namespace name 'KustoConnectionStringBuilder' could not be found CS0246:找不到类型或命名空间名称“System” - CS0246: The type or namespace name 'System' could not be found 错误CS0246:找不到类型或命名空间名称“AssemblyFileVersion” - Error CS0246: The type or namespace name 'AssemblyFileVersion' could not be found 错误 CS0246:找不到类型或命名空间名称“Newtonsoft” - Error CS0246: The type or namespace name 'Newtonsoft' could not be found 错误 CS0246:找不到类型或命名空间名称“CsvHelper” - error CS0246: The type or namespace name 'CsvHelper' could not be found 错误CS0246:找不到类型或名称空间名称'WebDriverWait'? - Error CS0246: The type or namespace name 'WebDriverWait' could not be found?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM