Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NuGet2.5 native assemblies
AlSki
#1 Posted : Thursday, May 23, 2013 3:06:26 PM(UTC)
Rank: Member

Groups: Registered
Joined: 2/28/2012(UTC)
Posts: 17
Location: London

Thanks: 1 times
Was thanked: 2 time(s) in 2 post(s)
For a while now we've been trying at work to get rid of the last non-packaged dependencies for our applications. We already used NuGet for std things, e.g. nunit.framework, specflow, moq, should etc. and our own internal libraries but we just had some unmanaged dlls that we couldn't get around. Now we can package these up and use another "new in 2.5" feature, import props and targets, to automatically copy our unmanaged dlls over to the bin/debug directory. This means that it all works nicely under F5, and also under Resharpers test runner, but not under NCrunch.

When you are using NCrunch you also need to configure Additional files to include to ..\packages\xxxx.1.0.17038\lib\native. Unfortunately this needs manually updating should you refresh the NuGet package to a later version.

I had a thought though, just as NCrunch already allows you to call the post build step, I wonder if you would consider letting us specify a some additional msbuild targets to run too. That way the imported packages can still be called so our test dependencies are handled, and NCrucnh can still warn us that we are slowing down the build by calling these additional targets :-).

What do you think?

Remco
#2 Posted : Thursday, May 23, 2013 9:36:38 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
It's interesting that NCrunch isn't picking up the native assemblies using its normal reference resolution. Is it that these assemblies are co-located with other files needed for them in order to run? A lower maintenance but more expensive (performance-wise) way to handle this would be to include the entire Nuget packages directory in your additional files to include (i.e. '..\packages\**.*'). This means that updating versions wouldn't require the extra manual step, although your project workspaces would become much bigger to house all the additional files ... which means the engine would take a bit longer to spin up.

It certainly is possible with the current version of NCrunch to run special build steps coded into the project files. You can do this with the 'BeforeBuild' and 'AfterBuild' targets that exist in the default .csproj file template. If you want them only to run under NCrunch, you can make these steps conditional. For example:

<Target Name="BeforeBuild" Condition="$(NCrunch) == '1'">
... do funky file copying here ...
</Target>
<Target Name="AfterBuild" Condition="$(NCrunch) == '1'">
... do funky file copying here ...
</Target>

You can also make Import declarations conditional:

<Import Project="..\build\MyCustomNCrunchBuild.targets" Condition="$(NCrunch) == '1'" />
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download