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

Notification

Icon
Error

Copy additional files also need CopyReferencedAssembliesToWorkspace
marwinge
#1 Posted : Thursday, January 4, 2018 9:53:14 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/4/2018(UTC)
Posts: 4
Location: Norway

Thanks: 1 times
Hi!

I am using a grid node server for this scenario.

I am referencing a nuGet package that have a dll that my integration test need to run. This dll is added in a sub-folder of bin (\bin\x64\Debug\net462\x64) when building the test project locally with Visual Studio. This does not happen when building with ncrunch, the dll is not in the workspace. Probably something with this nuget package is special so the copy is triggered when building with Visual Studio. Just my speculation, I am no nuGet expert.

To get this file included on the gride node I have added it as an additonal file. This does not work by itself. If I also set the CopyReferencedAssembliesToWorkspace to true, it works. So to me it seems that the folder structure is not created on the grid node unless the CopyReferencedAssembliesToWorkspace is set to true.

For reference; this is the configuration I currently use and that is working. I also had to setup the architecture and build configuration to have ncrunch pick up the dll:

<ProjectConfiguration>
<Settings>
<AdditionalFilesToIncludeForProject>
<Value>bin\x64\Debug\net462\x64\e_sqlite3.dll</Value>
</AdditionalFilesToIncludeForProject>
<BuildProcessArchitecture>x64</BuildProcessArchitecture>
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
<UseBuildConfiguration>Debug</UseBuildConfiguration>
<UseBuildPlatform>x64</UseBuildPlatform>
<UseCPUArchitecture>x64</UseCPUArchitecture>
</Settings>
</ProjectConfiguration>

So here comes my two questions:
- Is this expected behaviour?
- Could I setup this in another way to avoid copying the entire bin folder to the grid node all the time?

Thanks!
Remco
#2 Posted : Thursday, January 4, 2018 10:52:37 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for posting!

It's difficult to give a solid answer here without fully understanding the mechanism used by this Nuget package to copy the DLL into the bin\x64\Debug\net462\x64 directory. Is this a publicly available Nuget package? I might be able to take a look to see how it copies the file.

If the package is using a custom build step to do the copying, the ideal solution may be as simple as making sure the Nuget package itself is included in the workspace. NCrunch usually does this automatically, but some packages can slip the net. Are you referencing this with PackageReference, or packages.config?

Is this DLL being referenced directly from your test project, or indirectly via another project that your test project is referencing?
marwinge
#3 Posted : Monday, January 8, 2018 7:58:57 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/4/2018(UTC)
Posts: 4
Location: Norway

Thanks: 1 times
Thanks for getting back to me!

It is a public nuget package; SQLitePCLRaw.bundle_green

The test project is a net core application targeting net462, using PackageReferences. Here are the csproj file (removed package references that is not related to this problem):

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SQLite" Version="2.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="1.1.9" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Infosoft.S4.DeliveryService\Infosoft.S4.DeliveryService.csproj" />
</ItemGroup>

</Project>
Remco
#4 Posted : Monday, January 8, 2018 11:05:01 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks for sharing these extra details. I've built a sample project containing these references and have analysed the build logic involved here. It looks like the file is being copied via standard MSBuild logic. It's a bit more complicated than other references because this particular file seems to be platform/CPU specific, so it's kind of chained in to the system rather than specified directly. However, I don't seem to be seeing the same behaviour as you are. When NCrunch builds the project in its workspace, it seems to be copying the e_sqlite3.dll to the correct location.

When referencing the project from another project without the SQLLite dependency, e_sqlite3.dll is not copied into the referencing project's output directory (as designed), when 'Copy Referenced Assemblies to Workspace' is enabled, this file is also copied to the referencing project.

You mention that you're using this with a grid node. Are you noticing any difference in behaviour between the grid node and your local machine?

I just thought I'd also confirm that you're using NCrunch v3.12 (the latest build), since there's been quite a bit of work done on the CPS based projects over the last few months.
marwinge
#5 Posted : Tuesday, January 9, 2018 7:54:26 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/4/2018(UTC)
Posts: 4
Location: Norway

Thanks: 1 times
Thank you for your investigations.

I can confirm that I am using the latest version. I can also confirm that it only affects the grid nodes. To have the tests successfully run (it builds on grid nodes, but the tests fails with a message saying that it cant find the e_sqlite3.dll) on a grid node I must use the settings mentioned in post #1. On local machine it works without those customization.

Remco
#6 Posted : Tuesday, January 9, 2018 11:05:37 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
I think this issue may be related to synchronisation of the nuget packages over the grid.

Could you try copying the contents of your User\.nuget directory over to the corresponding user on the grid node? I think that perhaps the grid node doesn't have the nuget package installed, and for some reason NCrunch isn't transferring it.
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.052 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download