我在哪里可以获得GUID值创建DLL的接口和类,C#

Fre*_*ser 6 c# com dll guid

我在哪里可以获得接口的GUID值以及用于在C#中创建DLL的类?我使用的是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);
    }
Run Code Online (Sandbox Code Playgroud)

}}

Mat*_*ten 5

使用您选择的GUID生成器,或点击此链接


GuidAttribute类

当不需要自动GUID时提供显式的System.Guid。

它只需要与Guid该类的Constructor兼容:

传递给属性的字符串的格式必须是Guid类型可接受的构造函数参数。为避免与Guid类型冲突,请明确使用长名称GuidAttribute。仅当类型必须具有特定的GUID时才使用显式的GUID。如果省略该属性,则会自动分配一个GUID。