如何使用VS2005创建web安装包

今天看见一片文章详细介绍了如何使用vs2005创建web setup工程。winform的setup工程应该也遵循同样的步骤。

 

文章图文并茂,介绍了下面的内容

1. 创建setup工程

2. 使用安装程序类。 

3. 添加项目输出

4. 在安装程序类型修改config文件,写注册表,连接数据库,并创建Website并指定端口.

 

文章连接:

http://www.cnblogs.com/xuzhixiong/archive/2006/06/27/437056.html

展开阅读全文

VS2005制作WEB安装包

01-17

[size=11px]我现在用VS2005制作了安装包,可以建立站点,但是建好的站点必须手工去设置执行权限、集成WIndows验证、framework版本设为2.0等等属性,请问高手有没有办法在程序中就可以把上面这些属性就设置好?用.net建立IIS站点,不是虚似目录哦。。。我的系统是Win2003 + IIS6.0[/size]rn[code=C#]namespace SetupClassrnrn [RunInstaller(true)]rn public partial class MyInstaller : Installerrn rn private string DBName;rn private string ServerName;rn private string AdminName;rn private string AdminPwd;rnrn private string iis;rn private string port;rn private string dir;rn public static string VirDirSchemaName = "IIsWebVirtualDir";rn private string _target;rn private DirectoryEntry _iisServer;rn private ManagementScope _scope;rn private ConnectionOptions _connection;rn public MyInstaller()rn rn InitializeComponent();rn rnrn /// rn /// 写入webconfigrn /// rn /// rn private bool WriteWebConfig()rn rnrn System.IO.FileInfo FileInfo = new System.IO.FileInfo(this.Context.Parameters["targetdir"] + "/web.config");rnrn if (!FileInfo.Exists)rn rn throw new InstallException("文件丢失:" + this.Context.Parameters["targetdir"] + "/web.config");rn rn System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();rn xmlDocument.Load(FileInfo.FullName);rn bool FoundIt = false;rn foreach (System.Xml.XmlNode Node in xmlDocument["configuration"]["appSettings"])rn rn if (Node.Name == "add")rn rn if (Node.Attributes.GetNamedItem("key").Value == "connectionString")rn rn Node.Attributes.GetNamedItem("value").Value = String.Format("Persist Security Info=False;Data Source=0;database=1;User ID=2;Password=3;Packet Size=4096;Pooling=true;Max Pool Size=100;Min Pool Size=1", ServerName, DBName, AdminName, AdminPwd);rn FoundIt = true;rn rn rn rn if (!FoundIt)rn rn throw new InstallException("写入web.config文件时出错");rn rn xmlDocument.Save(FileInfo.FullName);rn return FoundIt;rn rnrn /// rn /// 连接IISrn /// rn /// rn public bool Connect()rn rn if (iis == null)rn return false;rn tryrn rn _iisServer = new DirectoryEntry("IIS://" + iis + "/W3SVC/1");rn _target = iis;rn _connection = new ConnectionOptions();rn _scope = new ManagementScope(@"\\" + iis + @"\root\MicrosoftIISV2", _connection);rn _scope.Connect();rn rn catchrn rn return false;rn rn return IsConnected();rnrn rn public bool IsConnected()rn rn if (_target == null || _connection == null || _scope == null) return false;rnrn return _scope.IsConnected;rn rnrn /// rn /// 判断网站是否存在rn /// rn /// rn /// rn public bool IsWebSiteExists(string serverID)rn rn tryrn rn string siteName = "W3SVC/" + serverID;rn ManagementObjectSearcher searcher = new ManagementObjectSearcher(_scope, new ObjectQuery("SELECT * FROM IIsWebServer"), null);rn ManagementObjectCollection webSites = searcher.Get();rn foreach (ManagementObject webSite in webSites)rn rn if ((string)webSite.Properties["Name"].Value == siteName)rn return true;rn rn return false;rn rn catchrn rn return false;rn rn rnrn private int GetNextOpenID()rn rn DirectoryEntry iisComputer = new DirectoryEntry("IIS://localhost/w3svc");rn int nextID = 0;rn foreach (DirectoryEntry iisWebServer in iisComputer.Children)rn rn string sname = iisWebServer.Name;rn tryrn rn int name = int.Parse(sname);rn if (name > nextID)rn rn nextID = name;rn rn rn catchrn rn rn rn return ++nextID;rn rnrn #region CreateWebsite 添加网站rn public string CreateWebSite(string serverID, string serverComment, string defaultVrootPath, string HostName, string IP, string Port)rn rn tryrn rn ManagementObject oW3SVC = new ManagementObject(_scope, new ManagementPath(@"IIsWebService='W3SVC'"), null);rn if (IsWebSiteExists(serverID))rn rn return "该程序已存在";rn rn ManagementBaseObject inputParameters = oW3SVC.GetMethodParameters("CreateNewSite");rn ManagementBaseObject[] serverBinding = new ManagementBaseObject[1];rn serverBinding[0] = CreateServerBinding(HostName, IP, Port);rn inputParameters["ServerComment"] = serverComment;rn inputParameters["ServerBindings"] = serverBinding;rn inputParameters["PathOfRootVirtualDir"] = defaultVrootPath;rn inputParameters["ServerId"] = serverID;rn rn ManagementBaseObject outParameter = null;rn outParameter = oW3SVC.InvokeMethod("CreateNewSite", inputParameters, null);rnrn[code] 论坛

vs2005无法创建Web Control Library

05-29

我想在VS2005中开发一个自定义控件,但我新建工程时找不到Web Control Library这个选择项(Web Control Library是写自定义控件的工程) rn以下是我安装VS2005的版本信息. rn谢谢了! rn小弟现在还没有分可送.本人再次表示感谢! rn在线等! rnMicrosoft Visual Studio 2005 rnVersion 8.0.50727.42 (RTM.050727-4200) rnMicrosoft .NET Framework rnVersion 2.0.50727 rn安装的版本: Enterprise rnMicrosoft Visual Basic 2005 55603-204-0000016-41193 rnMicrosoft Visual Basic 2005 rnMicrosoft Visual C# 2005 55603-204-0000016-41193 rnMicrosoft Visual C# 2005 rnMicrosoft Visual C++ 2005 55603-204-0000016-41193 rnMicrosoft Visual C++ 2005 rnMicrosoft Visual J# 2005 55603-204-0000016-41193 rnMicrosoft Visual J# 2005 rnMicrosoft Visual Studio Tools for Office 55603-204-0000016-41193 rnMicrosoft Visual Studio Tools for the Microsoft Office System rnMicrosoft Visual Web Developer 2005 55603-204-0000016-41193 rnMicrosoft Visual Web Developer 2005 rnVisual Studio 2005 Team Edition for Architects 55603-204-0000016-41193 rnMicrosoft Visual Studio 2005 Team Edition for Software Architects rnVisual Studio 2005 Team Edition for Developers 55603-204-0000016-41193 rnMicrosoft Visual Studio 2005 Team Edition for Software Developers rnVisual Studio 2005 Team Edition for Testers 55603-204-0000016-41193 rnMicrosoft Visual Studio 2005 Team Edition for Software Testers rnCrystal Reports AAC60-M0CSA4K-U70004R rnCrystal Reports for Visual Studio 2005 rnFortifyAddin rnFor more information about Fortify Software, see the Fortify Software website at rnhttp://www.FortifySoftware.com rnFor customer support, call (650) 213-5600. rnCopyright (c) 2005 Fortify Software Inc. 论坛

VS2005安装包问题

06-05

Hi,我不太清楚如何使用installer类并获取安装信息。rn 我现在想实现一个简单的功能,就是在Custom Actions中,把CustomActionData传递给一个dll,rn 我取名叫call_Action.dll,具体步骤我就不写了,我只写大致的框架。rn 我的call_Action.dll中实现Instller类继承的代码如下(主要是从msdn上考的):rn// This is the main DLL file.rnrn#include "stdafx.h"rn#include "windows.h"rn#include "stdio.h"rn#include "string"rnrn#include "Call_Action.h"rnrn#using rn#using rnrnusing namespace System;rnusing namespace System::Collections;rnusing namespace System::Collections::Specialized;rnusing namespace System::ComponentModel;rnusing namespace System::Configuration::Install;rnrnrnrnrnrn// Set 'RunInstaller' attribute to true.rnrn[RunInstaller(true)]rn EXPORTS ref class MyInstallerClass: public Installerrnrnprivate:rn void InstallBase()rn rn InstallContext^ myInstallContext;rn //Console::WriteLine(myInstallContext->Parameters["Myfile"]);rn //Console::WriteLine("我是一条龙啊");rn rnrn rnrnrnpublic:rn MyInstallerClass()rn rnrn rnrn // Override the 'Install' method.rn virtual void[color=#FF3300] Install[/color]( IDictionary^ savedState ) overridern rn FILE *myfile;rn myfile=fopen("G:\\project\\Call_Custom_Install\\debug\\myfile.txt","at+");rn if(myfile)rn rn fputc('c',myfile);rn rn InstallContext^ myInstallContext;rn [color=#0000FF]fprintf(myfile,"%s",myInstallContext->Parameters["Myfile"]);[/color]rn fprintf(myfile,"%s","sdfsd");rn fclose(myfile);rn Installer::Install( savedState );rn this->InstallBase();//调用上面的方法;rn rnrn // Override the 'Commit' method.rn virtual void Commit( IDictionary^ savedState ) overridern rn Installer::Commit( savedState );rn rnrnrn // Override the 'Rollback' method.rn virtual void Rollback( IDictionary^ savedState ) overridern rn Installer::Rollback( savedState );rn rnpublic:rn IDictionary^ g_savedState;rnrn;rnrnint main()rnrnrn Console::WriteLine( "Usage : installutil.exe Installer.exe " );rnrnrnrn[backcolor=#FF3300]void yy()[/backcolor]rnrn rn MyInstallerClass My_insall;rn My_insall.Install(My_insall.g_savedState);rn //My_insall.g_savedStatern //FILE *myfile;rn //InstallContext^ myInstallContext;rn //myfile=fopen("G:\\project\\Call_Custom_Install\\debug\\myfile.txt","at+");rn //if(myfile)rn //rn // fprintf(myfile,"%s",myInstallContext->Parameters["Myfile"]);rn // //fprintf(myfile,"%s","sdfsd");rn // //fputc(myInstallContext->Parameters["Myfile"],myfile);rn //rn //fclose(myfile);rn rnrnrn我在Custom Action中的参数是这样填的:rnInstallerClass:flase EntryPoint:yy CustomActionData:/Myfile="ddd"rn结果是,的确进到了yy函数,并调用了install函数,但是问题是myInstallContext->Parameters["Myfile"]取出来的值是空的,我不知道怎么去调用这么个函数(补充下,我的dll工程是clr的class library)rn我本来尝试过吧yy()写成yy(IDictionary^ savedState)的,然后custom action参数是这样写的:rnInstallerClass:true EntryPoint:yy CustomActionData:/Myfile="ddd" 安装包是完成了,但是call rndll这个步骤好像被终止掉了,所以现在的问题是IDictionary^ savedState 在那里用?它是在那里被赋值的?如何能够解决我现在这个问题,能吧Myfile这个参数传进去,让myInstallContext->Parameters["Myfile"]取到?rnrnrnrn补充下:我本来是想把MyInstallerClass类给EXPORTS的,这样就能在custom action里直接entrypoint:install ,可好像不准exports,所以我就借用了yy()这个函数来中转下,但我感觉IDictionary^ savedState 在非installer继承类中使用是无效的,对吗?rnrn谢谢~ rnNicholas. 论坛

没有更多推荐了,返回首页