Dependency names in deps.json

(JohnMoshakis) #1


This is a piece of deps.json

“targets”: {
“.NETCoreApp,Version=v2.2”: {
“CarterHelloWorldWebApp/1.0.0”: {
“dependencies”: {
“carter”: “3.10.0”
“runtime”: {
“CarterHelloWorldWebApp.exe”: {

Would I be right in thinking that the name in the dependencies section is generated from the folder name in the .nuget folder ?

With Carter the foldername is all lower case but the actual assembly is Carter.dll

Carter is making use of the class DependencyContext

This is the source for the carter code

It does this

return library.Dependencies.Any(dependency => dependency.Name.Equals(carterAssemblyName));

Its using it to locate classes.

It wasnt able to find classes until I went into the elements file and changed the nuget reference to match the case of the assembly

<NuGetReference Include=“carter:[3.10.0]”>

I changed this to

<NuGetReference Include=“Carter:[3.10.0]”>

Deps.json is now

".NETCoreApp,Version=v2.2": {
  "CarterHelloWorldWebApp/1.0.0": {
    "dependencies": {
      "Carter": "3.10.0"
    "runtime": {
      "CarterHelloWorldWebApp.exe": {

and my web api starts working.


(JohnMoshakis) #2

This is a testcase

DependencyContext .zip (1.8 MB)

DependencyContextConsoleApp is the one I created in Visual Studio. The other was created in Fire.

The casing causes the code to raise the exception.

  var context := DependencyContext.Load(&Assembly.GetEntryAssembly());

  var name := typeOf(Carter.CarterExtensions).Assembly.GetName.Name;
  var carterLib := context.RuntimeLibraries.FirstOrDefault(l -> l.Name.Equals(name));

  if (not assigned(carterLib))then
      raise new Exception('We shouldnt get here');

(marc hoffman) #3

I believe it’s lowercase because thats how your reference is spelled

    <NuGetReference Include="carter:[3.11.0]">

Fix that to uppercase and it looks fine?

(I have an open issue that Fire/Water currently use the cache folder names (which are lowercase) do display references in Add References, which is a new side effect from having to restructure the cache folder to match Microsoft’s layout. that’ll be fixed soonish).

(JohnMoshakis) #4

The example works with the case change. I dont know if it does anything special or just always uses upper case.

(marc hoffman) #5

Well, if there’s lowercase everywhere, the build chain has n way to determine what the “proper” case could be. I can only go by what’s in the reference.

(JohnMoshakis) #6

The assembly isnt lower case thats why I was wondering if you used the name of the folder and should be using the assembly name instead.

Carter instead of carter

(marc hoffman) #7

Hm, yeah, but that entry in the .deps is about the package, not the assembly, afaict…

(marc hoffman) #8

Fixed, along with a bunch of other minor improvements to the version selector, and improvements for Gradle references too.

(JohnMoshakis) #9

Can I have a new build ?

(marc hoffman) #10

Maybe; a new Fire build is a bit more involved than shopping it off omg our CI system, and it’s getting evening. I’ll try.

(marc hoffman) #11


(JohnMoshakis) #12

The only documentation I can find is here

And what I presume is the source code for DependencyContext doesn’t appear to have any documentation.

(JohnMoshakis) #13

Could this one be looked into ?

I dont know if its a problem with the elements deps files or how its being used in carter. It would be nice to be able to add the reference and not have to modify the elements file.

(marc hoffman) #14

What part? I had considered this solved as per my last reply (it uses the case from the project now). What’s the remaining/new problem?

(JohnMoshakis) #15

It shows up as lowercase in the deps file

".NETCoreApp,Version=v2.2": {
  "ConsoleApplication/1.0.0": {
    "dependencies": {
      "carter": "3.11.0"
    "runtime": {
      "ConsoleApplication.exe": {
      "Echoes.dll": {

(marc hoffman) #16

Even with the reference being in the correct case? can you send me your current project as is (because for me, that fixed it).

(JohnMoshakis) #17

The casing hasnt changed (1.3 MB)

(marc hoffman) #18
    <NuGetReference Include="carter:[3.11.0]">

I feel like I’m on candid camera here…

(JohnMoshakis) #19

That’s what I get if I use Fire to add a reference

It needs to be Carter:[3.11.0] so that deps file ends up with the right case

“.NETCoreApp,Version=v2.2”: {
“ConsoleApplication/1.0.0”: {
“dependencies”: {
“Carter”: “3.11.0”
“runtime”: {
“ConsoleApplication.exe”: {
“Echoes.dll”: {

and the code in the test case works

(marc hoffman) #20

Yes. Which is what I told you two weeks ago.

And that too has been fixed a week ago, I even sent you a new build with the fix (but I also mentioned that that was a known problem when I told you to change the case).