濮阳杆衣贸易有限公司

主頁 > 知識庫 > 一步步做自己的webinstall安裝包

一步步做自己的webinstall安裝包

熱門標(biāo)簽:外呼系統(tǒng)用員工身份證 朝陽市地圖標(biāo)注 太原外呼電銷機器人費用 東莞語音電銷機器人排名 電話機器人廣告話術(shù) 使用智能電話機器人違法嗎 淘寶地圖標(biāo)注如何做 保山電話外呼管理系統(tǒng)怎么用 蘇州銷售外呼系統(tǒng)預(yù)算
1、 為了能更好的操作IIS,先添加個類庫(InstallClassLibrary)到項目中。附代碼
復(fù)制代碼 代碼如下:

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();//以下代碼為更改網(wǎng)站指定目錄權(quán)限
DirectoryInfo di = new DirectoryInfo("d:\\yourpath\\xml");
if((di.AttributesFileAttributes.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 表示應(yīng)用程序在進程內(nèi)運行,值 1 表示進程外,值 2 表示進程池
newRoot.Properties["AccessScript"][0] = true; // 可執(zhí)行腳本
newRoot.Invoke("AppCreate", true);
newRoot.Properties["DefaultDoc"][0] = "login.aspx";//設(shè)置起始頁
newRoot.Properties["AppFriendlyName"][0] = "applicationName"; // 應(yīng)用程序名
newRoot.CommitChanges();
root.CommitChanges();
}
catch (Exception ee)
{
MessageBox.Show("虛擬目錄創(chuàng)建失敗!您可以手動創(chuàng)建! " + ee.Message + ";" + ee.Source + ";" + ee.TargetSite + ";" + ee.InnerException + ";" + ee.StackTrace, "Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
}
}
}
}

2、添加安裝項目到解決方案中,然后在該安裝項目(Setup)中添加-項目輸出,把WEB內(nèi)容和剛才建立的類庫添加到目錄中。
3、在安裝項目左鍵在屬性窗口中更改制造商,安裝程序的標(biāo)題、是否針對所有用戶安裝、產(chǎn)品名等內(nèi)容。
右鍵-視圖-自定義操作,右鍵安裝-添加自定義操作-應(yīng)用程序文件夾,選擇“安裝類庫(InstallClassLibrary)”,添加完成后,在文件系統(tǒng)中右鍵應(yīng)用程序文件夾設(shè)置默認安裝目錄。
若還想去定義更多的用戶安裝數(shù)據(jù),請增加用戶界面。
您可能感興趣的文章:
  • 商店系統(tǒng) V4.7 正式版安裝包發(fā)布+免費商店 下載
  • 已證實Au_.exe是NSIS安裝包的一個組成部分與說明
  • c#制作類似qq安裝程序一樣的單文件程序安裝包
  • android實現(xiàn)程序自動升級到安裝示例分享(下載android程序安裝包)
  • 查看Python安裝路徑以及安裝包路徑小技巧
  • python學(xué)習(xí)之第三方包安裝方法(兩種方法)

標(biāo)簽:克拉瑪依 潛江 洛陽 西藏 運城 呼倫貝爾 阿里 綏化

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《一步步做自己的webinstall安裝包》,本文關(guān)鍵詞  一,步步,做,自己的,webinstall,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《一步步做自己的webinstall安裝包》相關(guān)的同類信息!
  • 本頁收集關(guān)于一步步做自己的webinstall安裝包的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    双桥区| 鹿泉市| 涿鹿县| 池州市| 吉安市| 金乡县| 南康市| 二连浩特市| 杭锦旗| 綦江县| 榆树市| 类乌齐县| 德清县| 萨嘎县| 哈尔滨市| 泾阳县| 西城区| 广水市| 通州区| 宝山区| 淮滨县| 信阳市| 昆山市| 南平市| 玉山县| 鸡东县| 高邮市| 东乌珠穆沁旗| 来安县| 隆化县| 塔城市| 安泽县| 略阳县| 江城| 宜章县| 巍山| 阳东县| 沙雅县| 永清县| 阳泉市| 积石山|