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

Assembly from dependencies manifest - different file extension - error when publishing nuget #538

Open
PATO-SOFT opened this issue Dec 6, 2024 · 3 comments
Labels
question Further information is requested

Comments

@PATO-SOFT
Copy link

Hi,
I'm trying to publish the nuget to the internal company feed in ADO, but following error occurres

Issue

Pushing xxx1.0.0-p.nupkg to 'https://pkgs.dev.azure.com/yyy/nuget/v2/'...
  PUT https://pkgs.dev.azure.com/yyy/nuget/v2/
Error:
  An assembly specified in the application dependencies manifest (CredentialProvider.Microsoft.deps.json) has already been found but with a different file extension:
    package: 'CredentialProvider.Microsoft', version: '1.3.0-alpha'
    path: 'CredentialProvider.Microsoft.dll'
    previously found assembly: 'C:\Users\user\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe'
error: Problem starting the plugin 'C:\Users\user\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe'. The operation was canceled.
error: Problem starting the plugin 'C:\Users\user\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe'. The operation was canceled.
error:   The operation was canceled.
  Unauthorized https://pkgs.dev.azure.com/yyy/nuget/v2/ 358ms
error: Response status code does not indicate success: 401 (Unauthorized).

Env and details

Following cmd is being used to publish nuget.

dotnet nuget push --api-key $apiKey --source $source $pathToPackage

I'm trying to publish .netstandard2.0 library developed on Windows 11.

The azure credentials provider has been installed using command

iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -AddNetfx"

so I believe the 1.3.0 versions has been installed.

ProductVersion extracted from ./plugins/netcore/CredentialProvier.Microsoft/CredentialProvider.Microsoft.dll: 1.3.0-alpha+b66855cc5cb87b5a1c6e925ab84a532ec9c72e8b

What I've tried

Changing deps.json

To change entries in CredentialProvider.Microsoft.deps.json from

{
  "runtimeTarget": {
    "name": ".NETCoreApp,Version=v6.0",
    "signature": ""
  },
  "compilationOptions": {},
  "targets": {
    ".NETCoreApp,Version=v6.0": {
      "CredentialProvider.Microsoft/1.3.0-alpha": {
        "dependencies": {
          "Microsoft.Artifacts.Authentication": "0.2.3-alpha",
          "Microsoft.Extensions.Logging": "6.0.0",
...

To

{
  "runtimeTarget": {
    "name": ".NETCoreApp,Version=v6.0",
    "signature": ""
  },
  "compilationOptions": {},
  "targets": {
    ".NETCoreApp,Version=v6.0": {
      "CredentialProvider.Microsoft/1.3.0": {
        "dependencies": {
          "Microsoft.Artifacts.Authentication": "0.2.3-alpha",
          "Microsoft.Extensions.Logging": "6.0.0",
...

But in this case i get following error

Unhandled exception. System.BadImageFormatException: Bad IL format. The format of the file 'C:\Users\user\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.exe' is invalid.

Use older versions

I've tried to install older versions like 1.3.0-alpha and 1.2.3. But still i'm getting same error (as at the beginning) only version changes in error message.

I would appreciate any suggestions 😄

@embetten
Copy link
Contributor

embetten commented Dec 7, 2024

Can you add the force flag to ensure you are using 1.3.0 isntead of 1.3.0-alpha if you haven't already ? If you are using dotnet do you need the netfx version? ex:
iex "& { $(irm https://aka.ms/install-artifacts-credprovider.ps1) } -Force"

Additionally, can you provide what versions of dotnet are available on your machine and any redacted logs from nuget/cred provider with the -v detailed flag added to the dotnet push command.

@embetten embetten added the question Further information is requested label Dec 7, 2024
@PATO-SOFT
Copy link
Author

PATO-SOFT commented Dec 8, 2024

I've run the provided command but nothing has changed. Still same error like at the beginning.

.NET SDKs

8.0.303 [C:\Program Files\dotnet\sdk]

.NET runtimes

Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

I believe that dotnet nuget push does not support -v flag (error: Unrecognized option '-v').

Edit

I've updated VS22 and sdk, so currently the version is:

9.0.101 [C:\Program Files\dotnet\sdk]

Additionally, in order to make sure that I'm using the latest version I've installed 1.3.0 manually from releases Microsoft.Net8.NuGet.CredentialProvider.zip.

Still same result

 An assembly specified in the application dependencies manifest (CredentialProvider.Microsoft.deps.json) has already been found but with a different file extension:
    package: 'CredentialProvider.Microsoft', version: '1.3.0-alpha'
    path: 'CredentialProvider.Microsoft.dll'
...

Edit2

Works out of the box on similar dev env on my colleagues pc - so probably the issue persist only on my machine.

Any thoughts how to diagnose it?

@davidknaack
Copy link

@PATO-SOFT I had this issue after following the manual setup instructions in this repo's README. I am using the environment variable to specify the plugins location, but while the README mentions the environment variable 'NUGET_PLUGIN_PATHS', it omits the 'NUGET_NETFX_PLUGIN_PATHS' and 'NUGET_DOTNET_PLUGIN_PATHS'. Updating my config to point 'NUGET_DOTNET_PLUGIN_PATHS' to the CredentialProvider.Microsoft.dll file resolved the 'assembly already found' issue. See NuGet #8151 for some relevant details about the change.

Maybe that information can help you to find the source of your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants