我可以从哪里获得用于在C#中创建动态链接库的接口和类的GUID值?我使用的是Viusal 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);
}}}
发布于 2011-09-09 22:07:50
使用您选择的GUID生成器或follow this link。
当不需要自动GUID时提供显式System.Guid。
它只需要与Guid类的构造函数兼容:
传递给特性的字符串的格式必须是类型Guid可接受的构造函数参数。若要避免与类型Guid冲突,请显式使用长名称GuidAttribute。仅当类型必须具有特定的GUID时才使用显式GUID。如果省略该属性,则会自动分配GUID。
发布于 2011-09-09 22:13:46
Type类的GUID属性。试一试
typeof(_Service).GUID;
typeof(Ebil).GUID;https://stackoverflow.com/questions/7362890
复制相似问题