Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can i get the GUID value the interface and class for creating DLL, C#

Tags:

c#

guid

dll

com

Where can I get the GUID value of the interface and of the class for creating DLL in C#? I use 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);
    }

} }

like image 610
Freank Schlösser Avatar asked Sep 09 '11 14:09

Freank Schlösser


2 Answers

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


GuidAttribute Class

Supplies an explicit System.Guid when an automatic GUID is undesirable.

It only has to be compatible with the Constructor of the Guid class:

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

like image 81
Matten Avatar answered Nov 06 '22 19:11

Matten


The GUID property of the Type class. Try

typeof(_Service).GUID;
typeof(Ebil).GUID;
like image 25
Juan Ayala Avatar answered Nov 06 '22 17:11

Juan Ayala