We have setup an internal nuget server. While setting things up we have several packages with .targets file which copies some dlls to output folder.
When we use these packages only the last nuget.target file (last package added) seems to be executing and copying the files to output folder.
Cant seem to figure this out as to why others wouldnt execute.
Any suggestion ?
EDIT:
Issue only arises during Debug Configuration.
Code below in csproj file...
<Import Project="..\..\..\packages\Package2.1.0.3504\build\Package2.targets" Condition="Exists('..\..\..\packages\Package2.1.0.3504\build\Package2.targets')" />
Nusepc file:
<file src="buildTargets\Pack1.targets" target="build\Pack1.targets" />
<file src="dlls\external\x64\Pack1Proj\Pack1.dll" target="runtimes\x64\lib\net451\Pack1.dll" />
Targets file:
<Target Name="AfterBuild" >
<Exec Command="xcopy /Y "$(MSBuildThisFileDirectory)..\runtimes\x86\lib\net451" "$(TargetDir)"" />
</Target>
Targets using the same name overwrite each other. So if you have multiple
<Target Name="AfterBuild">
only one will be run - the one that is imported last. In fact, AfterBuild
is an empty target defined in the common targets that is meant to be overwritten.
To make your targets compatible, use different methods to hook into this build step:
<Target Name="Package1AfterBuild" AfterTargets="AfterBuild">