Where can I get a GUID value for an interface and a class for creating a DLL, C #

Where can I get the GUID value of an interface and class for creating a DLL in C #? I am using Viusal Studio 2005. Please help.

using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace Wrapper { [Guid("")] => Where can i get this??? [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface _Service { [DispId(1)] SearchResponse ExecuteSearch(); } [Guid("")] => Where can i get this??? [ClassInterface(ClassInterfaceType.None)] [ProgId("Wrapper.Service")] public class Ebil : _Service { FactService ew; public Ebil() { ew = new FactService(); } public SearchResponse ExecuteSearch(SearchRequest searchRequest) { return ew.ExecuteSearch(searchRequest); } 

}}

+6
source share
2 answers

Use the GUID-Generator of your choice or follow this link .


GuidAttribute Class

Provides an explicit System.Guid when an automatic GUID is objectionable.

It should only be compatible with the constructor of the Guid class:

The string passed to the attribute must be in a format that is a valid constructor argument for type Guid. To avoid conflicts with the Guid type, use the long GuidAttribute name explicitly. Only use the explicit GUID when the type must have a specific GUID. If the attribute is omitted, a GUID is assigned automatically.

+4
source

The GUID property of the Type class. Try

 typeof(_Service).GUID; typeof(Ebil).GUID; 
+3
source

Source: https://habr.com/ru/post/896992/


All Articles