...或者我是否坚持使用自己的“XML 切割”功能。我想创建一个小型任务托盘应用程序,以便我可以快速将虚拟目录重新指向硬盘上的几个文件夹之一。
一点背景:
我的开发机器上的代码库有 3 个不同的 svn 分支。
Current Production Branch ( C:\Projects\....\branches\Prod\ )
Next Release Canidate Branch ( C:\Projects\....\branches\RCX\ )
Trunk ( C:\Projects\....\trunk\ )
我们的应用程序与我安装的第三方 CMS 集成
http://localhost/cms/
为了工作,我们的应用程序必须位于同一根目录中。所以:
http://localhost/app/
根据我正在处理的分支,我正在重新指向/app/
进入 IIS 管理器,将目录复制到上面列出的 3 个路径之一。只是觉得有一个快速应用程序来帮我做这件事会很方便。
好吧...这不是一个托盘应用程序,但您可以从命令行运行它。只需根据需要更改物理路径:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;
namespace Swapper
{
class Program
{
static void Main(string[] args)
{
using (DirectoryEntry appRoot =
new DirectoryEntry("IIS://Localhost/W3SVC/1/root/app"))
{
switch (args[0].ToLower())
{
case "prod":
appRoot.Properties["Path"].Value = @"e:\app\prod";
appRoot.CommitChanges();
break;
case "rcx":
appRoot.Properties["Path"].Value = @"e:\app\rcx";
appRoot.CommitChanges();
break;
case "trunk":
appRoot.Properties["Path"].Value = @"e:\app\trunk";
appRoot.CommitChanges();
break;
default:
Console.WriteLine("Don't know");
break;
}
}
}
}
}
然后运行如下:
C:\>swapper prod
C:\>swapper rcx
etc
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)