Navcontainerhelper: "The Type [System.IO.Packaging.Package] could not be found" when using -replaceDependencies

Created on 25 Oct 2019  路  17Comments  路  Source: microsoft/navcontainerhelper

We are trying to use the -replaceDependencies parameter to publish a custom Base Application and then import the TestToolkit.

Publish-NewApplicationToBCContainer `
    -containerName $containerName `
    -appDotNetPackagesFolder (Join-Path $alProjectFolder ".netpackages") `
    -appFile $app `
    -credential $credential `
    -useNewDatabase `
    -restoreApps Yes `
    -doNotUseDevEndpoint `
    -replaceDependencies $replaceDependencies

Import-TestToolkitToBcContainer `
    -containerName $containerName `
    -includeTestLibrariesOnly `
    -credential $credential `
    -replaceDependencies $replaceDependencies

This throws the error "The Type [System.IO.Packaging.Package] could not be found.".

NavContainerHelper is version 0.6.4.14
Host is Microsoft Windows 10 Enterprise - ltsc2019
Docker Client Version is 19.03.4
Docker Server Version is 19.03.4
Pulling image mcr.microsoft.com/businesscentral/onprem:1910-de-ltsc2019
1910-de-ltsc2019: Pulling from businesscentral/onprem
Using image mcr.microsoft.com/businesscentral/onprem:1910-de-ltsc2019
Disabling Health Check (always report healthy)
Removing container Industry27B
Removing Industry27B from hosts
Removing C:\ProgramData\NavContainerHelper\Extensions\Industry27B
Creating Container Industry27B
Version: 15.0.36560.0-de
Style: onprem
Platform: 15.0.36510.0
Generic Tag: 0.0.9.95
Container OS Version: 10.0.17763.737 (ltsc2019)
Host OS Version: 10.0.17763.805 (ltsc2019)
[...]
Checking dependencies in C:\ProgramData\NavContainerHelper\Extensions\Industry27B\Extensions\Microsoft_ELSTER VAT Localization for Germany_15.0.36560.0.app
Copy from container Industry27B (C:\Applications\Elster\Source\Elster.app) to C:\ProgramData\NavContainerHelper\Extensions\Industry27B\_Elster.app
Checking dependencies in C:\ProgramData\NavContainerHelper\Extensions\Industry27B\_Elster.app
WARNING: Could not publish :Elster.app - The Type [System.IO.Packaging.Package] could not be found.
Copy from container Industry27B (C:\Applications\TestFramework\TestLibraries\Any\Microsoft_Any.app) to C:\ProgramData\NavContainerHelper\Extensions\Industry27B\_Microsoft_Any.app
Checking dependencies in C:\ProgramData\NavContainerHelper\Extensions\Industry27B\_Microsoft_Any.app
Publish-NavContainerApp : The Type [System.IO.Packaging.Package] could not be found.
In C:\Users\christoph.stuber\OneDrive - BE-terna GmbH\Dokumente\WindowsPowerShell\Modules\navcontainerhelper\0.6.4.14\O
bjectHandling\Import-TestToolkitToNavContainer.ps1:152 char:13
+             Publish-NavContainerApp -containerName $containerName -ap ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.IO.Packaging.Package:TypeName) [Publish-NavContainerApp], Runt
   imeException
    + FullyQualifiedErrorId : TypeNotFound,Publish-NavContainerApp
bug Ships in a future version

Most helpful comment

My problem is solved with this fix

All 17 comments

You have removed a large part of the output [...], which might be relevant, could you include that?
It looks like the problem is in publish-newapp and not in import-tests?
Is the elster app a runtime package?

The complete output is in the attachment output.txt

The Elster app and other default apps are probably runtime packages.

I at first thought that this was due to runtime packages, but probably not.

Are you running as administrator?
If not, that could be the cause?

If you are, you could try to add this right before calling publish-newapplication... :

Invoke-scriptinnavContainer -containername <container> -scriptblock { 
    add-type -path (Get-Item "C:\Program Files\Microsoft Dynamics NAV\*\Service\system.io.packaging.dll").FullName
}

Neither running as administrator nor adding your suggested code resulted in a different output.

Did you try this on other machines (maybe non-german host machines)?
also, Could you share the script you use?

The script is attached Create-IndustryBaseApp.txt (some information is obfuscated)

This error can be reproduced on three different machines, but all three are german.

I have the same issue when I am importing the TestToolKit in a build pipeline (with replace dependecies). The build agent is running on my local machine. Outside the build pipeline I have no issues with replace dependecies.
Import-TestToolkit.zip

So you are saying that if you run the pipeline on your machine it fails - if you run it manually it works?
What user is the pipeline running as?
is that running elevated?

Yes, that is what I am saying. I am running the agent in the command prompt as Administrator (as discribed in the "cicd workshop.pdf"

This is the error message:
Copy from container IEM15W1-bld (C:\Applications\TestFramework\TestLibraries\Any\Microsoft_Any.app) to C:\ProgramData\NavContainerHelper\Extensions\IEM15W1-bld_Microsoft_Any.app
Checking dependencies in C:\ProgramData\NavContainerHelper\Extensions\IEM15W1-bld_Microsoft_Any.app

[error]Publish-NavContainerApp : Unable to find type [System.IO.Packaging.Package].

[error]At C:\Program Files\WindowsPowerShell\Modules\navcontainerhelper\0.6.4.15\ObjectHandling\Import-TestToolkitToNavContain

er.ps1:152 char:13

I have skipped the removal of the container in the build pipeline to test the import of the testtoolkit manually. Now the testtoolkit is imported without any issues. (same docker container)

Will see if I can make a repro, thanks

@cbrandemann: sorry, this is somehow offtopic:
What "cicd workshop.pdf" are you refering to?
I would like to move this process to an Azure Pipleline, but need further input/help.
(@cstuber is sitting next to me) 馃槈

I found the bug - will release a fix today.

My problem is solved with this fix

Thanks

Runs without problems now. Thanks

Thanks for reporting this and sorry for not seeing the problem immediately

Was this page helpful?
0 / 5 - 0 ratings