C# CA1017与VS2010 StyleCop相关的ComVisible错误
我有CA1017错误消息,StyleCop说我需要将其设置为falseC# CA1017与VS2010 StyleCop相关的ComVisible错误,c#,.net,visual-studio-2010,stylecop,comvisible,C#,.net,Visual Studio 2010,Stylecop,Comvisible,我有CA1017错误消息,StyleCop说我需要将其设置为false Error 18 CA1017 : Microsoft.Design : Because 'NationalInstruments.Labview.FPGA.ModelsimCommunicator.dll' exposes externally visible types, mark it with ComVisible(false) at the assembly level and then mark all
Error 18 CA1017 : Microsoft.Design :
Because 'NationalInstruments.Labview.FPGA.ModelsimCommunicator.dll' exposes externally
visible types, mark it with ComVisible(false) at the assembly level and then mark all
types within the assembly that should be exposed to COM clients with ComVisible(true).
然后,我将代码[assembly:ComVisible(false)]
放在最上面的名称空间之前。但是,我仍然收到了相同的错误和其他错误消息
Error 19 The type or namespace name 'ComVisible' could not be found (are you
missing a using directive or an assembly reference?)
Error 20 The type or namespace name 'ComVisibleAttribute' could not be found (are
you missing a using directive or an assembly reference?)
看来VS2010也不认识这个名字
这有什么问题?中定义了
因此,您需要:
[assembly: System.Runtime.InteropServices.ComVisible(false)]
using
指令添加到源文件顶部,以导入该文件的命名空间:
using System.Runtime.InteropServices;
[assembly: System.Runtime.InteropServices.ComVisible(false)]
using
指令添加到源文件顶部,以导入该文件的命名空间:
using System.Runtime.InteropServices;