Build/Test Issues

Referencing packages from targets file doesn't work

Started by forki23 on 5,325 views

In https://github.com/fsprojects/Paket/tree/targets we created .targets files for the NuGet packages.

In order to reproduce you can

0) Clone or download the targets branch from the link above
1) Run build.cmd to restore all files
2) Open VS and build in VS (works)
3) Activate nCrunch - build doesn't work since nCrunch can't understand the targets files

the _ncrunchereferences folder seems to be OK and "Copy Referenced Assemblies To Workspace" doesn't help.

Cheers,
Steffen
Hi Steffen,

Thanks for sharing this one. I'll take a look and will see what I can do :)

Did using the 'Additional files to include' setting allow you to include the files manually and work around the problem?


Cheers,

Remco
Hi Remco,

all files are in the _ncrunchereferences. It just can't reference these, because the references are in a .targets file

Cheers,
Steffen
Ahhh - I understand now. This could be a big problem, and I don't think NCrunch is able to solve it in its current state.

NCrunch works by overriding references inside the project file at build time. This includes rewriting the project file by removing existing references and re-adding them with stricter declarations pointing at the locations inside _ncrunchreferences.

Where there is additional logic around these references (for example, they are situated inside target files external to the project file, or they have conditional logic attached to them), NCrunch cannot manipulate these references because they existing outside its normal working scope. There are unfortunate limits to NCrunch's intelligence when working with customised build setups, and references declared outside the project file unfortunately go beyond these limits. I recommend redesigning your build so that the references can sit within the project file.
I think that's totally OK to overwrite references - but it should be done recursivly in targets files
forki23 wrote:I think that's totally OK to overwrite references - but it should be done recursivly in targets files


I agree, but unfortunately NCrunch is limited by what the underlying toolset (MSBuild) is able to provide. This probably seems crazy, but because the references are by definition imported, MSBuild will not allow them to be manipulated. Sorry, but this problem cannot be solved in NCrunch.

Post a reply

Log in to reply.