【问题标题】:"This application can only run in the context of an app container." - New to Visual Studio 2015 dev“此应用程序只能在应用程序容器的上下文中运行。” - Visual Studio 2015 开发新手
【发布时间】:2016-02-13 00:40:12
【问题描述】:

我有点绝望。几个小时以来,我一直在尝试解决以下问题。

我开发了一个应用程序,现在我尝试使用 Visual Studio 2015 的安装向导扩展来安装它。一切都在构建或(没有错误),但是当我打开应用程序时,它突出显示它只能在应用程序容器的上下文中打开。那是什么意思?任何建议将不胜感激!

该应用正在使用 SQlite 数据库。这可能与依赖关系有关吗?如果是这样,我该如何解决这个问题?

更新:

# Culture = "en-US"
ConvertFrom-StringData @'
###PSLOC
    PromptYesString = &Yes
    PromptNoString = &No
    BundleFound = Found bundle: {0}
    PackageFound = Found package: {0}
    CertificateFound = Found certificate: {0}
    DependenciesFound = Found dependency package(s):
    GettingDeveloperLicense = Acquiring developer license...
    InstallingCertificate = Installing certificate...
    InstallingPackage = \nInstalling app...
    AcquireLicenseSuccessful = A developer license was successfully acquired.
    InstallCertificateSuccessful = The certificate was successfully installed.
    Success = \nSuccess: Your app was successfully installed.
    WarningInstallCert = \nYou are about to install a digital certificate to your computer's Trusted People certificate store. Doing so carries serious security risk and should only be done if you trust the originator of this digital certificate.\n\nWhen you are done using this app, you should manually remove the associated digital certificate. Instructions for doing so can be found here: http://go.microsoft.com/fwlink/?LinkId=243053\n\nAre you sure you wish to continue?\n\n
    ElevateActions = \nBefore installing this app, you need to do the following:
    ElevateActionDevLicense = \t- Acquire a developer license
    ElevateActionCertificate = \t- Install the signing certificate
    ElevateActionsContinue = Administrator credentials are required to continue.  Please accept the UAC prompt and provide your administrator password if asked.
    ErrorForceElevate = You must provide administrator credentials to proceed.  Please run this script without the -Force parameter or from an elevated PowerShell window.
    ErrorForceDeveloperLicense = Acquiring a developer license requires user interaction.  Please rerun the script without the -Force parameter.
    ErrorLaunchAdminFailed = Error: Could not start a new process as administrator.
    ErrorNoScriptPath = Error: You must launch this script from a file.
    ErrorNoPackageFound = Error: No package or bundle found in the script directory.  Please make sure the package or bundle you want to install is placed in the same directory as this script.
    ErrorManyPackagesFound = Error: More than one package or bundle found in the script directory.  Please make sure only the package or bundle you want to install is placed in the same directory as this script.
    ErrorPackageUnsigned = Error: The package or bundle is not digitally signed or its signature is corrupted.
    ErrorNoCertificateFound = Error: No certificate found in the script directory.  Please make sure the certificate used to sign the package or bundle you are installing is placed in the same directory as this script.
    ErrorManyCertificatesFound = Error: More than one certificate found in the script directory.  Please make sure only the certificate used to sign the package or bundle you are installing is placed in the same directory as this script.
    ErrorBadCertificate = Error: The file "{0}" is not a valid digital certificate.  CertUtil returned with error code {1}.
    ErrorExpiredCertificate = Error: The developer certificate "{0}" has expired. One possible cause is the system clock isn't set to the correct date and time. If the system settings are correct, contact the app owner to re-create a package or bundle with a valid certificate.
    ErrorCertificateMismatch = Error: The certificate does not match the one used to sign the package or bundle.
    ErrorCertIsCA = Error: The certificate can't be a certificate authority.
    ErrorBannedKeyUsage = Error: The certificate can't have the following key usage: {0}.  Key usage must be unspecified or equal to "DigitalSignature".
    ErrorBannedEKU = Error: The certificate can't have the following extended key usage: {0}.  Only the Code Signing and Lifetime Signing EKUs are allowed.
    ErrorNoBasicConstraints = Error: The certificate is missing the basic constraints extension.
    ErrorNoCodeSigningEku = Error: The certificate is missing the extended key usage for Code Signing.
    ErrorInstallCertificateCancelled = Error: Installation of the certificate was cancelled.
    ErrorCertUtilInstallFailed = Error: Could not install the certificate.  CertUtil returned with error code {0}.
    ErrorGetDeveloperLicenseFailed = Error: Could not acquire a developer license. For more information, see http://go.microsoft.com/fwlink/?LinkID=252740.
    ErrorInstallCertificateFailed = Error: Could not install the certificate. Status: {0}. For more information, see http://go.microsoft.com/fwlink/?LinkID=252740.
    ErrorAddPackageFailed = Error: Could not install the app.
    ErrorAddPackageFailedWithCert = Error: Could not install the app.  To ensure security, please consider uninstalling the signing certificate until you can install the app.  Instructions for doing so can be found here:\nhttp://go.microsoft.com/fwlink/?LinkId=243053

另一个更新:在 PowerShell 中以管理员身份运行旁加载安装脚本,现在收到以下错误:

无法注册包。 (HRESULT 异常:0x80073CF6) 谷歌搜索,但 Windows 10 开发人员的结果并不多。

【问题讨论】:

  • 这是什么类型的应用程序..你能更具体..
  • 谢谢你的方法Man。这是一个测验应用程序。它仅允许志愿者使用 4 个问题(带有插图)来接近街上的人,以对他们进行人口贩运问题的测验。它是一种外展工具。每次用户答对问题时,他们都会得到一分。一旦志愿者返回,他们需要将结果导出到 csv 文件。
  • 谢谢蒂姆。我看到了,但该帖子并没有太大帮助,因为我需要使用易于使用的安装程序分发此应用程序。
  • MethodMan 大概会问,这个应用程序适用于什么平台? “应用容器”部分听起来像是 Metro(现代/沉浸式)应用,在这种情况下,您需要使用 Windows 应用商店部署它。

标签: c# installation visual-studio-2015 windows-10 uwp


【解决方案1】:

如果这是一个商店/UWP 应用,那么它只能通过 appx 包安装。通常这应该通过商店。
无法使用 MSI 安装现代/商店/UWP 应用程序。

如果您不想(或不能)通过商店分发,那么您可以创建一个可以直接安装的包。

在 VS 中转到:PROJECT > Store > Create App Packages... > 然后选择 No 为商店构建包

在您可以在机器上安装应用之前,您需要在该机器上启用开发者功能:
设置 > 更新和安全 > 对于开发者 > 选择:旁加载应用程序

然后只需运行使用包创建的 PowerShell 脚本来安装它。

您关于商店提交需要 7 天的评论听起来不正确。通常提交将在一个小时内完成,仅在特殊情况下需要一天以上。

【讨论】:

  • 谢谢马特。这是一个很好的建议。非常感谢。我还弄清楚了为什么我的应用程序包没有安装。我在包名称中有一个特殊字符:'|'。 Visual Studio 没有在清单文件中将此作为问题突出显示,但它阻止我根据您在 Windows 10 上的说明直接加载实际上是家庭的应用程序(我知道这在 Windows 8 中似乎很痛苦)。谢谢一切为了你的好建议。焦急的几个小时后,我看到'应用程序安装成功'的提示,让我非常非常高兴:D
  • 现在微软拥有您的应用程序和您的体验 - 这太疯狂了!再见免费编程!
【解决方案2】:

据我所知,商店应用程序只能由 shell 启动。所以试试这个:

explorer.exe shell:AppsFolder\Microsoft.WindowsAlarms_8wekyb3d8bbwe!App

或从运行(Win+R):

shell:AppsFolder\Microsoft.WindowsAlarms_8wekyb3d8bbwe!App

有关打开和创建快捷方式的更多详细信息,请查看这篇文章:http://winaero.com/blog/exclusive-how-to-start-a-modern-app-from-desktop-without-going-to-the-metro-start-screen/

【讨论】:

    【解决方案3】:

    这可能是一个 Metro 应用程序,它不应该使用安装程序进行部署,而是使用应用商店。

    【讨论】:

    • 感谢您对 Soeren 的评论。绝对地。不幸的是,商店最多需要 7 天的时间来批准,我们需要该应用程序在 2 天内举办活动。
    • 有些环境可以侧载,也可以从 deb 机器呈现。除此之外,它们就是规则。
    • 了解。谢谢 Soeren。会记住这一点。但是任何解决方法和/或其他建议来完成这项工作都将受到高度赞赏!
    • 您可以尝试编写一个脚本来更改本地组策略,然后使用 powershell 安装 .appx。 maketecheasier.com/… 但这有点骇人听闻,不是 MS 认可的,我自己没有尝试过,还有 YMMV。绝对是您暂时只想要作为紧急解决方案的东西。
    猜你喜欢
    • 1970-01-01
    • 2018-02-02
    • 1970-01-01
    • 2015-12-10
    • 2017-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多