麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網站 > 幫助中心 > 正文

一步步做自己的webinstall安裝包

2024-07-09 22:47:06
字體:
來源:轉載
供稿:網友
1、 為了能更好的操作IIS,先添加個類庫(InstallClassLibrary)到項目中。附代碼
代碼如下:
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.DirectoryServices;
using System.Diagnostics;
using System.Windows.Forms;
using System.Security.AccessControl;
using System.IO;
namespace InstallClassLibrary
{
[RunInstaller(true)]
public partial class WebInstaller : Installer
{
public WebInstaller()
{
InitializeComponent();
}
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
CreateVirtualDir();//以下代碼為更改網站指定目錄權限
DirectoryInfo di = new DirectoryInfo("d://yourpath//xml");
if((di.Attributes&FileAttributes.ReadOnly)!=0)
di.Attributes=FileAttributes.Normal;
DirectorySecurity ds=di.GetAccessControl();
ds.AddAccessRule(new FileSystemAccessRule("NETWORK SERVICE",FileSystemRights.Modify,InheritanceFlags.ObjectInherit|InheritanceFlags.ContainerInherit,
PropagationFlags.None,AccessControlType.Allow));
di.SetAccessControl(ds);
//
}
void CreateVirtualDir()
{
try
{
DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC/1/root");
DirectoryEntry newRoot = root.Children.Add("virtualName", root.SchemaClassName);
newRoot.Properties["Path"][0] = "d://yourpath"; //this.Context.Parameters["targetdir"];
newRoot.Properties["AppIsolated"][0] = 2; // 值 0 表示應用程序在進程內運行,值 1 表示進程外,值 2 表示進程池
newRoot.Properties["AccessScript"][0] = true; // 可執行腳本
newRoot.Invoke("AppCreate", true);
newRoot.Properties["DefaultDoc"][0] = "login.aspx";//設置起始頁
newRoot.Properties["AppFriendlyName"][0] = "applicationName"; // 應用程序名
newRoot.CommitChanges();
root.CommitChanges();
}
catch (Exception ee)
{
MessageBox.Show("虛擬目錄創建失敗!您可以手動創建! " + ee.Message + ";" + ee.Source + ";" + ee.TargetSite + ";" + ee.InnerException + ";" + ee.StackTrace, "Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
}
}
}
}

2、添加安裝項目到解決方案中,然后在該安裝項目(Setup)中添加-項目輸出,把WEB內容和剛才建立的類庫添加到目錄中。
3、在安裝項目左鍵在屬性窗口中更改制造商,安裝程序的標題、是否針對所有用戶安裝、產品名等內容。
右鍵-視圖-自定義操作,右鍵安裝-添加自定義操作-應用程序文件夾,選擇“安裝類庫(InstallClassLibrary)”,添加完成后,在文件系統中右鍵應用程序文件夾設置默認安裝目錄。
若還想去定義更多的用戶安裝數據,請增加用戶界面。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 双性精h调教灌尿打屁股的文案 | 黄视频网站免费在线观看 | 一级色毛片 | 日本a在线观看 | 精品99在线视频 | 热99re久久免费视精品频软件 | 在线看一区二区三区 | 免费看日产一区二区三区 | av在线播放地址 | 日韩欧美色综合 | 色柚视频网站ww色 | 97久久日一线二线三线 | 91精品动漫在线观看 | 黄色的视频免费观看 | 免费午夜视频在线观看 | 中文字幕在线观看视频一区 | 成人毛片免费视频 | 欧美成人免费电影 | 中文字幕一二三区芒果 | 伊人午夜视频 | 成人黄色小视频在线观看 | 精品在线免费播放 | 视频国产一区二区 | 国产在线中文 | 妇女毛片| 蜜桃视频在线播放 | 毛片免费观看视频 | 久久91亚洲人成电影网站 | 久久视讯 | 亚洲福利在线视频 | 国产福利视频在线观看 | 免费网站看v片在线a | 国产91av视频 | 久久伊人国产精品 | 黄网站进入| 久久久久久久免费看 | 国产精品久久久久久久不卡 | 中文字幕在线观看免费 | 一级免费在线 | 精品久久久久99 | 国产无遮挡一区二区三区毛片日本 |