0

I'm working with a C# .NET project that uses a Nuget package created by other project running in a CI circuit. The Nuget package, internally, has the "lib\net35" folder where the required assembly is located. So, in my project, I have something like this:

<Reference Include="MyCustomAssembly, Version=22.11.62, Culture=neutral, processorArchitecture=x86">
      <HintPath>..\packages\MyCustomAssembly.22.11.62\lib\net35\MyCustomAssembly.dll</HintPath>
</Reference>

Everything is fine until here. If I update the package to a newer version, the process do what I need. My problem begins when we add in the Nuget package the same assembly but compiled in other platform. This package have the normal "lib\net35" and now we have "runtimes\win-x64\native" folder with the same assembly compiled in x64 (the original in "lib\net35" is compiled in x86). Adding this new assembly to the Nuget package makes me change the reference path in the original project and it looks like this:

<Reference Include="MyCustomAssembly, Version=22.11.62, Culture=neutral, processorArchitecture=x64">
      <HintPath>..\packages\MyCustomAssembly.22.11.62\runtimes\win-x64\native\MyCustomAssembly.dll</HintPath>
</Reference>

Everything is fine here. I have changed the assembly's path in the project and it's compiling flawless. But If I update the package from the Nuget Manager, the process changes the assembly's path back to "lib\net35" and don't respect the older path. My question: Is that normal? How can I solve this behavior (if it's by design)? I just need to put in my package multiple platforms of the same assembly and use it in other projects without the need to change the path every time I update the Nuget package. Another detail: I'm not using the new PackageReference, we still use the packages.config management format.

Hope to be clear, my English is still not very good. Thank you!

PD: Now we are investigating with PackageReference but I want to know if it is possible to accomplish this without changing the management format.

Sebastian Garcia
  • 333
  • 1
  • 3
  • 6

0 Answers0