Standard: Missing netfx.force.conflicts.dll problem, again

Created on 10 Apr 2018  路  4Comments  路  Source: dotnet/standard

Situation:

  • a net461 project refers to a netstandard2.0 NuGet package
  • the net461 project uses old project format but the new PackageReference tag
  • the net461 project contains XAML Workflow Activity definitions
  • using VS 15.6.5

Problem:

  • the XAML codegen adds a reference to netfx.force.conflicts: assemblyList.Add(Load("netfx.force.conflicts, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"));
  • but this .dll is not copied to the output directory
  • it causes exception: System.IO.FileNotFoundException: Could not load file or assembly 'netfx.force.conflicts, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

Workaround:

  • ~manually copying a netfx.force.conflicts.dll to the output solves the problem, the app runs~
  • ~I don't know whether this .dll necessary at runtime at all, maybe generating assemblyList.Add(Load("netfx.force.conflicts... is unnecessary~
  • Based on this comment, the reference is unnecessary, apply this hack to the .csproj and the reference to this .dll will disappear from the generated .cs file.

Repro:

referring #481 dotnet/sdk#1930

I don't know whether dotnet/project-system is a better place for this issue?

Most helpful comment

You do not need to add that reference and it is not required at runtime. That dll is only needed at compile time since it is the one that will force some dll conflicts so that automatic binding redirects are generated on your app鈥檚 config file. Because this file is not needed at runtime, we have targets that will remove it specifically from your bin directory so you shouln鈥檛 add code that tries to load it. If you actually inspect this dll, you鈥檒l find that it has no code at all, just a few type forwards in order to get the conflicts at compile time.

All 4 comments

This is a reincarnation of dotnet/sdk#1522. Until that issue is reopened I leave this issue open.

You do not need to add that reference and it is not required at runtime. That dll is only needed at compile time since it is the one that will force some dll conflicts so that automatic binding redirects are generated on your app鈥檚 config file. Because this file is not needed at runtime, we have targets that will remove it specifically from your bin directory so you shouln鈥檛 add code that tries to load it. If you actually inspect this dll, you鈥檒l find that it has no code at all, just a few type forwards in order to get the conflicts at compile time.

@joperezr You are right! After adding this hack to .csproj, the generated .cs got ~50 references shorter, and the reference to netfx.force.conflicts.dll is disappeared. I will update the workaround in the issue. Thank you for the information!

Given that this is an issue with the sdk I will close this one for now. Feel free to reopen the sdk one since as you suggest, looks like the problem isn鈥檛 yet fixed

Was this page helpful?
0 / 5 - 0 ratings