Open yodantauber opened 11 years ago
If you have the items in the bin folder something like this:
bin : { foo.dll, bar.dll };
And want them only copied when linking to dynamic libraries, you can put a condition in front of that:
[dynamic]
bin : { foo.dll, bar.dll };
if it's more complex than that, could you post your .autopkg file?
Thanks, but I tried this and it didn't change anything. Correct me if I'm wrong, but isn't the [dynamic] condition for controlling whether the package is to be linked dynamically vs. statically to the consuming project (rather than determining whether the consuming project is an EXE, DLL or LIB)?
In other words, my package may be in DLL form, and it may be used by a static project, which in turn is used by an EXE. Both the static project and the EXE consume the package, but the DLL of the package should only be copied to the output folder of the EXE.
The relevant MSBuild condition is probably something like '$(ConfigurationType)'!='StaticLibrary'.
I think this can be resolved by adding a section such as this one:
configurations {
// type of the consuming project
ConsumingType {
Key:OTHER_STUFF;
choices : { StaticConsumer, NonStaticConsumer };
StaticConsumer.condition = "('$(ConfigurationType)'=='StaticLibrary')";
NonStaticConsumer.condition = "('$(ConfigurationType)'!='StaticLibrary')";
}
}
Then, the conditions [NonStaticConsumer]
and [StaticConsumer]
can be used to control whether to specify DLLs with "bin: " (to have them copied) or some "custombin: " (which doesn't copy them).
Another possible solution: If you accept my suggestion in issue 20, this copying can be disabled for all LIB projects by setting their "3rdPartyDllDir" to an empty string (either by the package consumer, or by the package itself using a condition such as the one in the above comment).
I have a native NuGet package with some DLLs defined with "bin:" in the autopkg file. When any native project which consumes the generated package is built, these DLLs are copied to the output folder of the project.
This may be desired if the consuming project is an application or a DLL by itself, but is probably undesirable if the consuming project is a static library (in our case, static libraries are built to a separate "lib" output folder).
I think this behavior should either be possible to toggle on/off, or turned off altogether for consuming projects which are static libraries.