如何引用 Microsoft.Web.Administration? [英] How to reference Microsoft.Web.Administration?

查看:26
本文介绍了如何引用 Microsoft.Web.Administration?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft.Web.Administration 程序集位于我机器上的 C:WindowsSystem32inetsrv 中.我相信它是作为 IIS 的一部分安装的.该程序集也在 GAC 中.

The Microsoft.Web.Administration assembly is found in C:WindowsSystem32inetsrv on my machine. I believe it is installed as part of IIS. The assembly is also in the GAC.

我应该如何从我的项目中引用这个程序集,因为我想将该项目提交到 SVN 以供其他人签出.Microsoft.Web.Administration 未出现在 Visual Studio 的添加引用"列表中.我可以添加对 C:WindowsSystem32inetsrvMicrosoft.Web.Administration 的引用,但这似乎是个坏主意,因为其他开发人员可能会将其安装在不同的路径或驱动器上.

How should I reference this assembly from my project, given that I want to commit the project to SVN for others to checkout. Microsoft.Web.Administration does not appear in the Visual Studio 'Add References' list. I can add a reference to C:WindowsSystem32inetsrvMicrosoft.Web.Administration, but this seems like a bad idea as other developers might have it installed on a different path or drive.

或者我可以将其复制到项目文件夹中,但随后我必须将二进制文件提交到 SVN.

Or I could copy it into the project folder, but then I have to commit the binary to SVN.

推荐答案

以下步骤对我有用:

  1. 转到C:WindowsSystem32inetsrv 并检查文件Microsoft.Web.Administration.dll 是否存在.如果您在 C:WindowsSystem32inetsrv 中缺少 Microsoft.Web.Administration.dll,请在您的 Windows 功能中启用 IIS 管理控制台:
  1. Go to C:WindowsSystem32inetsrv and check if the file Microsoft.Web.Administration.dll exists. If you are missing the Microsoft.Web.Administration.dll in C:WindowsSystem32inetsrv, enable IIS Management Console in your Windows Features:

  1. 在您的 Visual Studio 项目中,添加对 Microsoft.Web.Administration.dll 的引用:
  2. 现在您的 .proj 文件具有以下条目:C:WindowsSystem32inetsrvMicrosoft.Web.Administration.dll.您可以将此路径调整为例如%windir%System32inetsrvMicrosoft.Web.Administration.dll 使其更加健壮.

当您将应用移动到不同的系统时,该应用还会引用目标系统上的 Microsoft.Web.Administration.dll.由于 Microsoft.Web.Administration.dll 在 Windows 系统之间可能不同,因此不建议应用程序提供此程序集文件的副本.副本可能与目标系统上的 IIS 不兼容.

When you move the app to a different system, the app also references to the Microsoft.Web.Administration.dll on the target system. Because the Microsoft.Web.Administration.dll could be different between the windows systems it is not recommended to deliver a copy of this assembly file by the app. A copy could be incompatible with the IIS on the target system.

也不建议在同一系统上引用程序集的副本,因为 Microsoft.Web.Administrator.dll 和 IIS 可能会因 Windows 更新而改变!那么您引用的 Microsoft.Web.Administrator.dll 副本与更新的 IIS 不兼容.

It is also not recommended to reference a copy of the assembly on the same system, because perhaps the Microsoft.Web.Administrator.dll and the IIS will change due an Windows Update! Then your referenced copy of Microsoft.Web.Administrator.dll is incompatible with the updated IIS.

当目标系统上缺少 Microsoft.Web.Administrator.dll 时,请按照上述步骤 1 中的说明激活管理控制台.或者,您可以使用 cmd(以管理员身份打开)并通过 DISM.exe 通过以下命令激活 Windows 功能管理控制台:

When the Microsoft.Web.Administrator.dll is missing on the target system, then activate the Management Console as descibed in step 1 above. Alternatively you can use the cmd (open as Administrator) and activate the Windows Feature Management Console by DISM.exe via the following command:

C:WindowsSystem32Dism.exe /enable-feature /online /featurename:IIS-ManagementConsole

当您想通过设置分发应用时,此命令可能很有用.

This command could be useful when you want to distribute your app via an setup.

这篇关于如何引用 Microsoft.Web.Administration?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆