我是在应用文件件下引入类项目中的自定义类,但是输出时连应用的dll也输出了,有没办法,不输出应用的类,使程序正常运行,希望高手指点,谢谢。
解决方案 »
- C# LIstView 中获得选中某一项目出现的异常
- datagridview绑定数据源为啥没有显示MYSQL
- 大家来说说经验吧,CPU使用率达到多少才算不高呢?
- windform里面把窗体的边框设置成没有的时候,怎么样让鼠标可以移动它?
- 我要判断一个单元格里面的内容有没有12位,如果有的话发生事件?
- 如何在winform中嵌入execl?
- 又来麻烦大家了,关于数据查询的问题/?
- 请教:C#网络编程 tcpclient
- 用Google二维码识别程序库zxing开发的识别程序,为什么有的能识别,有的识别不了
- 关于asp.net几个问题(1.键盘事件2.用回车控制输入焦点3.combobox)
- 求个实习机会
- 微软公司是怎样管理程序源代码的?
用下面的命令创建一个新的随机密钥对并将其存储在 keyPair.snk 中
sn命令是.Net裡面的
sn -k keyPair.snk
第二步
右擊項目, 然後點屬性, 裡面有一個簽名的頁簽
在這個面簽中點上<為程序集簽名>
後下面的
選擇強名稱密鑰文件
選擇你剛才生成的keyPair.snk
這樣你的項目,生成後就有簽名了第三步
生成的DLL註冊到 GAC中就OK了
注冊後還要在註冊表項中
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx]
這個下面加一個鍵
如 BB
然後 BB的值就是你放DLL的路徑
你可以進到這個注冊項,應該已經有很多,你看一下就知道了如果後面的看不懂, 你就只看前面三步也就行了
也可以直接加我Google Talk: liuruxin2002 或是MSN: [email protected] 聯繫這些動作也可以在安裝項目中直接完成關鍵代碼如下
namespace RegistryDLL
{
[RunInstaller(true)]
public partial class InstallerGac : Installer
{
public InstallerGac()
{
InitializeComponent();
} public override void Commit(System.Collections.IDictionary savedState)
{
string dllPath = "";
string assemblyFullPath = Assembly.GetExecutingAssembly().Location; string FullPath = Path.GetDirectoryName(assemblyFullPath);
Publish publisher = new Publish();
dllPath = FullPath + "\\LRSubSystem\\AP\\LRComponent.APServer.dll";
publisher.GacInstall(dllPath);
dllPath = FullPath + "\\LRSubSystem\\AP\\LRComponent.DBManage.dll";
publisher.GacInstall(dllPath);
dllPath = FullPath + "\\LRSubSystem\\LRComponent.StandardLibaray.dll";
publisher.GacInstall(dllPath);
dllPath = FullPath + "\\LRSubSystem\\LRComponent.UIControls.dll";
publisher.GacInstall(dllPath); RegistryKey MyKey = Registry.LocalMachine;
RegistryKey SubKey = MyKey.OpenSubKey("SOFTWARE", true);
SubKey = SubKey.OpenSubKey("Microsoft", true);
SubKey = SubKey.CreateSubKey(".NETFramework");
SubKey = SubKey.CreateSubKey("v2.0.50727");
SubKey = SubKey.CreateSubKey("AssemblyFoldersEx");
RegistryKey wSubKey = SubKey.CreateSubKey("LRToolCase");
wSubKey.SetValue("", FullPath + "\\LRSubSystem\\");
wSubKey.Close();
wSubKey = SubKey.CreateSubKey("LRToolCaseAP");
wSubKey.SetValue("", FullPath + "\\LRSubSystem\\AP\\");
wSubKey.Close();
SubKey.Close();
MyKey.Close();
base.Commit(savedState);
}
public override void Uninstall(System.Collections.IDictionary savedState)
{
string dllPath = "";
string assemblyFullPath = Assembly.GetExecutingAssembly().Location;
string FullPath = Path.GetDirectoryName(assemblyFullPath);
Publish publisher = new Publish();
//反注冊組件到 GAC
dllPath = FullPath + "\\LRSubSystem\\AP\\LRComponent.APServer.dll";
publisher.GacRemove(dllPath);
dllPath = FullPath + "\\LRSubSystem\\AP\\LRComponent.DBManage.dll";
publisher.GacRemove(dllPath);
dllPath = FullPath + "\\LRSubSystem\\LRComponent.StandardLibaray.dll";
publisher.GacRemove(dllPath);
dllPath = FullPath + "\\LRSubSystem\\LRComponent.UIControls.dll";
publisher.GacRemove(dllPath); RegistryKey MyKey = Registry.LocalMachine;
RegistryKey SubKey = MyKey.OpenSubKey("SOFTWARE", true);
try
{
SubKey = SubKey.OpenSubKey("Microsoft", true);
SubKey = SubKey.OpenSubKey(".NETFramework", true);
SubKey = SubKey.OpenSubKey("v2.0.50727", true);
SubKey = SubKey.OpenSubKey("AssemblyFoldersEx", true);
SubKey.DeleteSubKey("LRToolCase");
SubKey.DeleteSubKey("LRToolCaseAP");
SubKey.Close();
MyKey.Close();
}
catch
{
SubKey.Close();
MyKey.Close();
}
base.Uninstall(savedState);
}
}
}