General Feedback

Dependencies for Targets aren't copied

Started by MatthewSteeples on 8,599 views

I'm still researching the answer for this, so may end up answering my own question, but I have the following problem:

Some NuGet packages (in my case Microsoft.Diagnostics.Tracing.EventRegister) contain .exe files that are executed as part of the build. The .targets file gets copied across to the grid node server to be included in the build but the .exe file (that it needs to run) doesn't.

I'm either looking for a way to disable this .targets file from being run, ignoring the error so that the project continues to build, or copying the .exe (and other files needed from the packages folder) so that the command runs successfully.
For now I have tweaked the csproj file to exclude the .targets reference when it's being built under NCrunch:

Changed
<Import Project="..\packages\Microsoft.Diagnostics.Tracing.EventRegister.1.0.26\build\Microsoft.Diagnostics.Tracing.EventRegister.targets" Condition="Exists('..\packages\Microsoft.Diagnostics.Tracing.EventRegister.1.0.26\build\Microsoft.Diagnostics.Tracing.EventRegister.targets')" />
to
<Import Project="..\packages\Microsoft.Diagnostics.Tracing.EventRegister.1.0.26\build\Microsoft.Diagnostics.Tracing.EventRegister.targets" Condition="Exists('..\packages\Microsoft.Diagnostics.Tracing.EventRegister.1.0.26\build\Microsoft.Diagnostics.Tracing.EventRegister.targets') AND '$(NCrunch)' != '1'" />
Hi, thanks for sharing this issue.

NCrunch is able to detect most dependencies of a build automatically, but sometimes .EXEs and other files are referenced obscurely from the build targets and NCrunch isn't able to pick them up. If you want your build to run the same in the NCrunch workspace as it does in the foreground solution, the easiest way to handle this is to just add the files to the 'Additional files to include' configuration setting. You can read more here about this problem - http://www.ncrunch.net/documentation/considerations-and-constraints_implicit-file-dependencies.

Edited

Remco wrote:... the easiest way to handle this is to just add the files to the 'Additional files to include' configuration setting.


Thanks for that. I think that's what we'll end up doing for some items. In this instance the executable is only required to run for the build process and is not necessary for testing so our current solution works.

Post a reply

Log in to reply.