Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-BcNuGetPackage - issue with generated dependencies in .nuspec #3782

Open
DevHarmonize opened this issue Dec 6, 2024 · 3 comments
Open
Assignees

Comments

@DevHarmonize
Copy link

PLEASE DO NOT INCLUDE ANY PASSWORDS OR TOKENS IN YOUR ISSUE!!!

Describe the issue
when using New-BcNuGetPackage, and the app.json file contains a dependency to an appsource app.
The created .nuget package will contain

<dependencies>
  <dependency id="PUBLISHER.appname.c660d68a-f693-46df-b383-96c8769e2634" version="24.0.0.0" />
  <dependency id="Microsoft.Application" version="23.0.0.0" />
  <dependency id="Microsoft.Platform" version="24.0.24140.0" />
</dependencies>

while the microsoft feed for appsource symbols
https://dynamicssmb2.visualstudio.com/DynamicsBCPublicFeeds/_artifacts/feed/AppSourceSymbols
publishes packages with the following format
PUBLISHER.appname.symbols.c660d68a-f693-46df-b383-96c8769e2634

When using the generated nuget package in another project as dependency with the paket tool, it gives an error for not finding the dependency on the provided feeds.

Scripts used to create container and cause the issue

 $package = New-BcNuGetPackage -appfile $(System.DefaultWorkingDirectory)\$(Build.Repository.Name)_$(Build.BuildNumber).app -destinationFolder "$(System.DefaultWorkingDirectory)\nuget"      

Full output of scripts

Create NuGet package
AppFile:
C:\agent\_work\112\s\xyz_xyz_Core_24.2024.1205.4202.app
NUSPEC file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="[http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">](http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd%22%3E)
    <metadata>
        <id>xyz.xyz.eebbf853-41a8-439c-9bee-da760802f82b</id>
        <version>24.2024.1205.4202</version>
        <title>xyz</title>
        <description>xyz</description>
        <authors>xyz</authors>
        <dependencies>
            <dependency id="PUBLISHER.appname.c660d68a-f693-46df-b383-96c8769e2634" version="24.0.0.0" />
            <dependency id="Microsoft.Application" version="23.0.0.0" />
            <dependency id="Microsoft.Platform" version="24.0.24140.0" />
        </dependencies>
    </metadata>
    <files>
        <file src="xyz_xyz_Core_24.2024.1205.4202.app" target="xyz_xyz_Core_24.2024.1205.4202.app" />
    </files>
</package>
Successfully created NuGet package (Size: 120Kb)
Preparing NuGet Package for submission
Submitting NuGet package

Could you add a parameter to New-BcNuGetPackage that uses Get-BcNuGetPackageId to buid the package ID, that would add .symbols to the name of the packageIDtemplate?
https://github.com/microsoft/navcontainerhelper/blob/main/NuGet/New-BcNuGetPackage.ps1

I tried with adding .symbols to the name of the dependency in app.json but the . gets stripped by $nname = [nuGetFeed]::Normalize($name) :)

thanks!

@freddydk
Copy link
Contributor

freddydk commented Dec 8, 2024

You define the dependencyIdTemplate, which by default is:

[string] $dependencyIdTemplate = '{publisher}.{name}.{id}',

but... IMO normal nuget packages should have normal dependencies (not symbols) and symbols nuget packages should have symbols dependencies.

In BcContainerHelper - all dependencies are handled using AppId only - not sure whether paket and other tools can do the same - but in the end - this is how Business Central works.

@kine
Copy link
Contributor

kine commented Dec 10, 2024

@DevHarmonize
I agree that symbol package should have dependency on symbol packages only and full package only on full packages.

For the tools like Paket and Nuget, when creating list of dependencies to download, it must be decided first, if you want to download symbols only or full packages. Based on that, the dependency names must be correctly created/resolved. When having dependency on AppSource app, you can download symbol packages and use the MS public feed for the packages. Then you can use them to compile your app. But if you need to deploy the packages to environment, you need full packages, thus you will need to have access to some feed including the full packages of the AppSource apps. This must be provided by the publisher.

It means, everytime you need first to decide if you need full or symbols packages. Based on that different sources and package names will be used. Never mix both.

@DevHarmonize
Copy link
Author

Thanks for the input.

The issue is, not every publisher has a feed. So I am resorting to the MSAppsource feed.

With info of Freddy that I can use the dependencyIdTemplate parameter, I can get around my issue.
I understand it's not the correct way, but for now it is the only way when I don't have a publisher feed, or they don't have a download portal that I can use to create my own packages?

We don't intend to use our packages for publishing, only to compile - the resulting app of the compile action can be used to publish no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants