AppDomain.ActivationContext 为 NULL [英] AppDomain.ActivationContext is NULL

查看:16
本文介绍了AppDomain.ActivationContext 为 NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中创建了一个 AppDomain.下面是我用过的代码

I have created an AppDomain in my application. Below is the code I have used

AppDomainSetup domaininfo = new AppDomainSetup();
domaininfo.ApplicationBase = "C:\\";
AppDomain domain = AppDomain.CreateDomain("MyDomain", null, domaininfo);
ActivationContext context = domain.ActivationContext;

但是 ActivationContext 在上面的代码片段中是 null.谁可以帮我这个事.提前致谢.

But the ActivationContext is null in above snippet. Can anyone help me on this. Thanks in Advance.

推荐答案

ActivationContext 是字节数组,其中包含与此 ActivationContext 关联的应用程序的 ClickOnce 部署清单.它用于获取当前应用程序的 ClickOnce 部署清单.

ActivationContext is byte array that contains the ClickOnce deployment manifest for the application that is associated with this ActivationContext. It is used to get the ClickOnce deployment manifest for the current application.

如果 ClickOnce 应用程序正在当前 AppDomain 中运行,请检查 AppDomain.CurrentDomain.ActivationContext 属性.如果该值不为空,则域正在运行 ClickOnce 应用程序.

if a ClickOnce application is running in the current AppDomain by checking the AppDomain.CurrentDomain.ActivationContext property. If that value is non-null, then the domain is running a ClickOnce application.

这可以通过检查项目属性安全"选项卡中的启用 ClickOnce 安全设置"来检查

This can be examined by Checking the "Enable ClickOnce security settings" in Project Properties "Security" tab

在正确的上下文中 ClickOnce 安全设置被禁用.因为它不是一次点击部署.所以上下文也默认为空

In the correct context ClickOnce security settings is disabled. Because it is not a click once deployment. So the context also will be null by default

这篇关于AppDomain.ActivationContext 为 NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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