When you create a new C# project in Visual Studio, the generated AssemblyInfo.cs file includes an attribute specifying an assembly GUID. The comment above the attribute states that it is used "if this project is exposed to COM".
None of my assemblies contain types which need to be visible to COM, so I have marked my assembly with [assembly: ComVisible(false)]
. Is there any point in specifying a GUID?
My feeling is that the answer is "no" - so why does the default AssemblyInfo.cs file contain both [assembly: ComVisible(false)]
and [assembly: Guid("...")]
?
Edit:
To summarize the responses:
Between them, the answers explain that specifying a GUID is required if and only if COM interop is being used. So, in my situation, a GUID is not necessary.
sharptooth further explains that [assembly: ComVisible(false)]
does not imply not using COM interop, since it is possible to override ComVisible
for individual types. It is for this reason that the default AssembyInfo.cs contains both [assembly: ComVisible(false)]
and a GUID.