2

For a desktop .NET Framework 4.6.2 app, when a netstandard2 assembly is referenced (Say e.g. System.Buffers or System.Threading.Tasks.Dataflow) a netstandard.dll will also be referenced and it ends up in the output directory. I’m using PackageReferences in the csproj.

Must the netstandard.dll be deployed to end users of the app, e.g. via the installer? If yes, for which target frameworks is that necessary? When must any other shim dlls (System.*.dll) be deployed? How to know exactly which are needed?

Anders Forsgren
  • 10,827
  • 4
  • 40
  • 77
  • target [.net 4.7.2](https://stackoverflow.com/a/53484849/1466046) to fix the issue of copied system dlls to output folder – magicandre1981 Dec 03 '18 at 14:37
  • I cannot solve by retargeting, I have to target 4.6.2 exactly. – Anders Forsgren Dec 03 '18 at 14:45
  • netstandard.dll is part of .net framework and you only need to deploy the additional system dlls if you target .net < 4.7.2 – magicandre1981 Dec 04 '18 at 15:00
  • I target 4.6.2. There are no System.* dll's in the build output. What does that mean? Checked a clean VM now: A machine with only 4.6.2 has no netstandard.dll and the program does not seem to run without it. So I assume I must ship it? – Anders Forsgren Dec 04 '18 at 16:06
  • I read this whole issue discussion https://github.com/dotnet/standard/issues/545 and still I’m confused about whether anything more than netstandard.dll is needed and when/why when consuming netstandard2 on 4.6.2. I need to list and manage all files explicitly in the setup script so it’s not feasible to have dozens of files or unused ones. – Anders Forsgren Dec 04 '18 at 18:27
  • the system dlls are only there if you add some nuget packages. Use [Fusion logging](https://stackoverflow.com/a/29374658/1466046) to see which DLLs get loaded. – magicandre1981 Dec 05 '18 at 14:34
  • I added some nuget packages as described, and they don't work without netstandard.dll, but they do work with only netstandard.dll and no other shims deployed (to a machine with only fw 4.6.2). So I'm wondering when those System.* dlls would be needed and how I could be made aware that they are needed (needed in the *installer* for end users I mean). I'm looking mostly for documentatoin about exactly what is needed when as I need to author and maintain the setyp scripts manually. – Anders Forsgren Dec 05 '18 at 15:16
  • use the Fusion logging that I shown in the linked topic on a clean PC where you haven't copied any of the additional files and see which DLLs the application tries to load. – magicandre1981 Dec 11 '18 at 14:38
  • That seems like it would require executing every single code line in the application before one can know which assemblies would be needed? I need to know exactly what asms *may* be needed, without using any runtime testing because it's not feasible otherwise. My question is more or less: is this possible with netstandard2.0 on 4.6.2 or should I just avoid it until I can run 4.7.2 when I can *know* I don't need to deploy anything? – Anders Forsgren Dec 12 '18 at 17:01
  • best option is go for 4.7.2. If you are forced to use old 4.6.2 use runtime testings and fusion logging to see which DLLs get loaded. – magicandre1981 Dec 12 '18 at 20:26

0 Answers0