【发布时间】:2018-12-11 20:28:50
【问题描述】:
我想将 testcase 属性设置到我的 c++/cli 类中。我正在为该属性添加 dll 引用。请注意,我在 C# 中用于属性设置的 dll。请找到以下代码:
using namespace Sample::Generic::TestAutomation::TestSystem;
namespace ClassLibrary1 {
[AttributeUsage(Sample::Generic::TestAutomation::TestSystem::TestCase)]
public ref class Class1 : public Sample::CheckIt::TestPool::TestCase
{
private:
static Class1^ Instance = nullptr;
GenericLogger^ Switchmodule_log;
TAIoPortClient^ _generalio;
bool _testCaseInit = false;
};
当我尝试使用此属性时,出现以下错误:
错误 C2275 'Sample::Generic::TestAutomation::TestSystem::TestCase': 非法使用这种类型作为 表达式 ClassLibrary1 c:\users\chan\documents\visual studio 2015\projects\classlibrary1\classlibrary1\ClassLibrary1.h 17
【问题讨论】:
标签: c# attributes c++-cli