Question: In:

```
// services
public interface Mother { public Collection<? extends Father> getMamaStuff() {}} 
public interface Daughter extends Mother {}

// data
public interface Father { public String getPapaStuff() }
public interface Son extends Father { public String playLoudMusic() }

```

why is this not allowed:

```
public class Clazz {

    Clazz(Daughter daughter) {//boilerplate}

    public Collection<Son> idk = doughter.getMamaStuff();
}

```

1. Is it because there is no way to know which implementation of Father
will Clazz get?
2. What is the good way to work around this?
3. Is instanceof good practice in this case?

It seems to me there is no way around type checking.

Answer: 
1.Looks like you're trying to add the credentials into `Nuget.config` file, this is **not recommended** because:

*We strongly recommend not checking your PAT into source control. Anyone with access to your PAT can gain access to your Azure DevOps Services.*

Though it's not recommended, it should work. For me I use command like:

```
dotnet nuget push --source "myfeed" --api-key az Test.1.0.0.nupkg

```

And the Nuget.config:

```
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="myfeed" value="https://pkgs.dev.azure.com/myacct/myproject/_packaging/myfeed/nuget/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <myfeed>
      <add key="Username" value="lancel" />
      <add key="ClearTextPassword" value="YourPat, instead of the APIkey" />
    </myfeed>
  </packageSourceCredentials>
</configuration>

```

It means you'll need to [create PAT](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page#create-personal-access-tokens-to-authenticate-access) which is scoped to the organization(s) you want to access with following permissions: Packaging (read), Packaging (read and write), or Packaging (read, write, and manage).

Then it should be `<add key="ClearTextPassword" value="%PAT%" />`.

2.And another direction is to use Azure Artifacts Credential Provider in [non-interactive scenarios](https://learn.microsoft.com/en-us/azure/devops/artifacts/nuget/dotnet-exe?view=azure-devops#on-build-machines-and-in-non-interactive-scenarios).

Run the helper script to install it automatically and set a `VSS_NUGET_EXTERNAL_FEED_ENDPOINTS` variable. The value of this variable should be:

```
{"endpointCredentials": [{"endpoint":"https://pkgs.dev.azure.com/myacct/myproject/_packaging/myfeed/nuget/v3/index.json", "password":"PAT"}]}

```
Try from the Package Manager Console,

`NuGet push -apikey <key> -source "feed_name" ./mypackage-1.0.1.nupkg`

Note the PMC version of NuGet requires -apikey and -source (-k and -s don't work)

For whatever reason, PMC works for me but dotnet nuget gives me a 401.