I have a nuspec file that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MyDll.Service</id>
<version>1.0.0</version>
<title>MyDll.Service</title>
<authors>MyDll</authors>
<owners>MyDll</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<copyright>Copyright © 2017</copyright>
<dependencies>
<dependency id="SomeDll" version="1.0.0" />
</dependencies>
<references>
<reference file="MyDll.Service.Context.dll" />
</references>
</metadata>
<files>
<file src="..\..\Folder\MyDll.Service.Context\bin\Release\MyDll.Service.Context.dll" target="lib\net452"/>
<file src="..\..\Folder\MyDll.Service\bin\Release\MyDll.Service.dll" target="lib\net452"/>
</files>
</package>
This generates me a nuget package that contains 2 dlls. The project itself only references MyDll.Service.Context.dll
(which is exactly what I want).
I am using injection to insert the MyDll.Service.dll
wherever the classes for MyDll.Service.Context.dll
are mentioned. My only problem is that when I build, the dll MyDll.Service.dll
is not pulled into the bin folder of the main project. Only the MyDll.Service.Context.dll
is. This makes sense because I only reference the context dll.
My question, how can I get MyDll.Service.dll
pulled into the bin folder upon building and publishing the project, without having to reference that dll in the project?
EDIT:
As per suggestion in the comments I tried to do this with MSBuild. I changed my nuspec to the following:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MyDll.Service</id>
<version>1.0.0</version>
<title>MyDll.Service</title>
<authors>MyDll</authors>
<owners>MyDll</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<copyright>Copyright © 2017</copyright>
<dependencies>
<dependency id="SomeDll" version="1.0.0" />
</dependencies>
<references>
<reference file="MyDll.Service.Context.dll" />
</references>
</metadata>
<files>
<file src="..\..\Folder\MyDll.Service.Context\bin\Release\MyDll.Service.Context.dll" target="lib\net452"/>
<file src="..\..\Folder\MyDll.Service\bin\Release\MyDll.Service.dll" target="lib\net452"/>
</files>
</package>
Unfortunately, all that did was cause my MyDll.Service.dll
dll to show up twice in my package, once in the build folder and once in the lib folder. However, upon build the dll was still not in the folder.