我做了一个自定义控件(EB.cs),该cs文件编译成dll并为其他工程所调用。
现在,我希望能知道dll文件所在的位置,该在cs文件中用什么语句?
例如,
我的cs文件在c:\EB.cs,编译dll后放在c:\dll\EB.dll中;
新项目EB中的文件c:\project\EB.aspx引用了EB.dll文件;EB.aspx为启动页面;
EB.dll文件绑定了EB.aspx上的一个Label控件(EB.dll中的一个自定义属性,手动设置)
我希望项目运行时,Label控件能显示出EB.dll文件所在的目录“c:\dll”来;
应该在cs文件中添加怎样的语句。
现在,我希望能知道dll文件所在的位置,该在cs文件中用什么语句?
例如,
我的cs文件在c:\EB.cs,编译dll后放在c:\dll\EB.dll中;
新项目EB中的文件c:\project\EB.aspx引用了EB.dll文件;EB.aspx为启动页面;
EB.dll文件绑定了EB.aspx上的一个Label控件(EB.dll中的一个自定义属性,手动设置)
我希望项目运行时,Label控件能显示出EB.dll文件所在的目录“c:\dll”来;
应该在cs文件中添加怎样的语句。
解决方案 »
- 文件的下载是怎样实现的?
- 关于把FCKeditor中的内容替换的问题,很急!!!
- 登录后返回访问页面
- 高手进来看看,这段<script>代码是循环滚动的,怎么让鼠标放上去停止滚动呢?
- 我是个新手,请问怎么可以在项目中使用gridview控件自定义删除控件
- 安装了一个控件,比如名称叫做abc.ctl,这个程序运行了一段时间后,怎么样把它卸掉,并且把它影响过的所有文件都还原?
- 该程序是ASP程序,原有一个首页,现在又设计了一个首页,把设计好的页替换那个原有页
- 关于给文件上传控件赋值的问题?高分马上送上!!
- Windows2003下用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败
- 登陆后单条查询-MVC
- 公司要做一个类似qq的企信通软件,用什么工具作既快又好?
- 请问如何用vb.net语言is判断object对象是否为linkbutton类型.
{
return System.Reflection.MethodInfo.GetCurrentMethod().ReflectedType.Module.FullyQualifiedName;}
System.Reflection.Assembly的CodeBase属性可返回程序集的路径下面的示例显示一个使用 CodeBase 属性的表达式。
[Visual Basic]
Dim SampleAssembly As [Assembly]
' Instantiate a target object.
Dim Integer1 As New Int32()
Dim Type1 As Type
' Set the Type instance to the target class type.
Type1 = Integer1.GetType()
' Instantiate an Assembly class to the assembly housing the Integer type.
SampleAssembly = [Assembly].GetAssembly(Integer1.GetType())
' Gets the location of the assembly using file: protocol.
Console.WriteLine(("CodeBase=" + SampleAssembly.CodeBase))
End Sub 'Snippet1
[C#]
Assembly SampleAssembly;
// Instantiate a target object.
Int32 Integer1 = new Int32();
Type Type1;
// Set the Type instance to the target class type.
Type1 = Integer1.GetType();
// Instantiate an Assembly class to the assembly housing the Integer type.
SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
// Gets the location of the assembly using file: protocol.
Console.WriteLine("CodeBase=" + SampleAssembly.CodeBase);
{
return System.Reflection.MethodInfo.GetCurrentMethod().ReflectedType.Module.FullyQualifiedName;
}
{
return System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
}或:public string GetDllPath()
{
return System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
}