ServerDocument.DeploymentManifestUrl 属性 (2007 system)
更新:2007 年 11 月
获取或设置与文档关联的 Visual Studio Tools for Office 自定义项的部署清单的 URL。
命名空间: Microsoft.VisualStudio.Tools.Applications
程序集: Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0(在 Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll 中)
语法
声明
Public Property DeploymentManifestUrl As Uri
用法
Dim instance As ServerDocument
Dim value As Uri
value = instance.DeploymentManifestUrl
instance.DeploymentManifestUrl = value
public Uri DeploymentManifestUrl { get; set; }
属性值
类型:System.Uri
一个 URL,指定与文档关联的自定义项的部署清单的名称和位置。
备注
如果您将自定义项的部署清单移动到另一个位置,并且希望文档从新位置查找自定义项的更新,则将此属性设置为新的 URL。如果设置此属性,则 URL 必须指向已经与文档关联的自定义项的部署清单。
不能使用此属性将新的自定义项与文档相关联。若要向未进行自定义的文档中添加自定义项,请使用 AddCustomization 方法。若要向自定义文档中添加不同的自定义项,请先使用 RemoveCustomization 方法移除当前的自定义项,然后使用 AddCustomization 方法。
示例
下面的代码示例使用 ServerDocument(String) 构造函数来创建一个加载指定文档的新 ServerDocument。然后,该示例显示附加到文档的 Visual Studio Tools for Office 自定义项的部署清单的 URL。
此示例需要在代码文件顶部使用对 Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll 和 Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll 程序集的引用,并对 Microsoft.VisualStudio.Tools.Applications 和 Microsoft.VisualStudio.Tools.Applications.Runtime 命名空间使用 Imports(对于 Visual Basic)或 using(对于 C#)语句。
Private Sub CreateServerDocumentFromPath(ByVal documentPath As String)
Dim runtimeVersion As Integer = 0
Dim serverDocument1 As ServerDocument = Nothing
Try
runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath)
If runtimeVersion = 3 Then
serverDocument1 = New ServerDocument(documentPath)
MessageBox.Show("The URL of the deployment manifest is: " & vbLf & _
serverDocument1.DeploymentManifestUrl.ToString())
End If
Catch ex As System.IO.FileNotFoundException
System.Windows.Forms.MessageBox.Show("The specified document does not exist.")
Catch ex As UnknownCustomizationFileException
System.Windows.Forms.MessageBox.Show("The specified document has a file " & _
"extension that is not supported by Visual Studio Tools for Office.")
Finally
If Not (serverDocument1 Is Nothing) Then
serverDocument1.Close()
End If
End Try
End Sub
private void CreateServerDocumentFromPath(string documentPath)
{
int runtimeVersion = 0;
ServerDocument serverDocument1 = null;
try
{
runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath);
if (runtimeVersion == 3)
{
serverDocument1 = new ServerDocument(documentPath);
MessageBox.Show("The URL of the deployment manifest is: \n" +
serverDocument1.DeploymentManifestUrl.ToString());
}
}
catch (System.IO.FileNotFoundException)
{
System.Windows.Forms.MessageBox.Show("The specified document does not exist.");
}
catch (UnknownCustomizationFileException)
{
System.Windows.Forms.MessageBox.Show("The specified document has a file " +
"extension that is not supported by Visual Studio Tools for Office.");
}
finally
{
if (serverDocument1 != null)
serverDocument1.Close();
}
}
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。