How to copy a dll present in my Nuget package to a subfolder in the consuming project directory? #13444
Unanswered
abhinavmathur06
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I have a requirement to create a NuGet package that contains an assembly and this assembly shall be copied in a subfolder of the consuming project *normally it would be copied in the base directory accordingly. So, if the output folder is like this bin\x64\Debug, then after the package is consumed and the solution is built, I should have the assembly placed inside bin\x64\Debug\someSubfolder. The inclusion of this package should not modify any other dll present in the output path!
Please note that the build platform and configuration defined above is just for example and it can be Debug/Release and AnyCPU/x64/x86.
Here are the few things which I have tried:
Approach 1:
I have created a nuspec file and kept the file section like this:
And I have the props file, which is a part of package, to make sure that the dll is correctly placed in the subfolder:
I'm able to generate and consume the package in the consuming project. However, with this approach, the some.framework.dll is correctly placed at bin\x64\Debug\someSubfolder but along with that, it is also overwriting an existing some.framework.dll with an older version present at bin\x64\Debug. This I have to avoid since I need both assemblies in both versions once in the base folder and once in the subfolder.
The older version of the assembly is coming from a different package and needs to stay in the base folder. Our package shall deploy the assembly in the subFolder to not invalidate the original deployment.
Approach 2:
I planned to place the dll as a contentFile inside the package. The packaging was successful, however, while consuming this package and during the build, I'm getting an error that the binaries are present in the contentFiles and the created package cannot be consumed without error.
Can someone help me with this request?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions