Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在哪里可以获得用于创建DLL的接口和类的GUID值,C#_C#_Dll_Com_Guid - Fatal编程技术网

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

在哪里可以获得用于创建DLL的接口和类的GUID值,C#,c#,dll,com,guid,C#,Dll,Com,Guid,在哪里可以获得接口的GUID值以及用于在C#中创建DLL的类的GUID值?我使用Viusal Studio 2005。请帮忙 using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace Wrapper { [Guid("")] => Where can i get this??? [InterfaceType(ComIn

在哪里可以获得接口的GUID值以及用于在C#中创建DLL的类的GUID值?我使用Viusal Studio 2005。请帮忙

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);
    }
}
}使用您选择的GUID生成器,或


在启用自动Guid时提供显式System.Guid 不受欢迎

它只需与
Guid
类的构造函数兼容:

传递给属性的字符串的格式必须为 类型Guid的可接受构造函数参数。避免冲突 对于类型Guid,显式使用长名称GuidAttribute。只有 当类型必须具有特定GUID时,请使用显式GUID。如果 属性,则会自动分配GUID


Type
类的
GUID
属性。试一试

typeof(_Service).GUID;
typeof(Ebil).GUID;

您正在询问如何生成要放置在属性构造函数中的guid,或者如何获取运行时放置在属性构造函数中的guid?我假设是后者。@Juan Ayala-不,他需要为他的类获取一些guid作为GuidAttribute的参数,它覆盖了自动类型guid。