5

First of all I read a few articles in this regards like https://learn.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks but they don't cover my scenario and whatever I tried didn't work.

I have totally 4 assemblies with the following configuraitons:

1. .NET Framework 4.5; Platform x86
2. .NET Framework 4.5; Platform x64
3. UWP10; Platform x86
4. UWP10; Platrofm x64

I don't have AnyCPU platform assemblies even for .NET Framework. All my assemblies either target x86 or x64. Everything that I found so far describes how to create a multi-platform package for UWP only. I didn't even try that yet because that topic is well covered. The question is how to package multi-platform package for .NET Framework 4.5. In accordance with the packaging articles it seems I have to have the following folder structure

runtimes
   win-x86
      lib
         net45
            MyAssembly.dll
   win-x64
      lib
         net45
            MyAssembly.dll

I created this structure and tried to consume the package. The package installs without errors but I cannot use MyAssembly.dll. It looks like the build does not find it. I tried different variations of folder names like "win10-x86", just "x86". Nothing works.

Is it even possible to have multi-platform packages for .NET Framework 4.5? Is there anybody who successfully created one? Please share the knowledge.

Thank you

Alex
  • 655
  • 1
  • 8
  • 16
  • What about https://stackoverflow.com/questions/19478775/add-native-files-from-nuget-package-to-project-output-directory? Check the most voted answer. – Lex Li Jul 20 '18 at 19:46
  • 2
    I saw that question. The question is more than 4 years old and if I'm not mistaken back than there was no "runtimes" section in NuGet whatsoever and in that situation I understand the solution was introduced via custom targets. Since then NuGet improved a lot and I assumed it's possible now to build platform specific packages for .NET Framework. I'm probably missing something to make it work. – Alex Jul 24 '18 at 19:11
  • 1
    I also wonder how this is possible, especially with SDK style projects. – Ray Jun 15 '20 at 19:17

1 Answers1

-1

It's been a while since you asked the question; did you have any luck or find a workaround?

If you check the documentation you link, it (now) says

These assemblies will only be available at runtime, so if you want to provide the corresponding compile time assembly as well then have AnyCPU assembly in /ref/{tfm} folder.

Thus, in addition to the runtimes folder, it seems you need an AnyCPU version of your library to support building, which is where it seems you were having problems.

jswolf19
  • 2,303
  • 15
  • 16