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

Notification

Icon
Error

Failure to copy across the dependencies
BrilliantSkies
#1 Posted : Sunday, March 30, 2025 7:10:05 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/16/2024(UTC)
Posts: 4
Location: United Kingdom

Thanks: 2 times
Here is the CSPROJ file for a solution I am having trouble with. One one of my machines that I've had NCRUNCH on for ages it works fine. On a new computer I get this issue.

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

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
</ItemGroup>


<ItemGroup>
<Reference Include="C:\REPOS\Code\Unity\Library\ScriptAssemblies\UnityEngine.UI.dll" Private="true"/>
<Reference Include="C:\Program Files\Unity\Hub\Editor\6000.0.26f1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll" Private="true" />
<Reference Include="C:\Program Files\Unity\Hub\Editor\6000.0.26f1\Editor\Data\Managed\UnityEngine\UnityEngine.Physics2DModule.dll" Private="true" />
<Reference Include="C:\Program Files\Unity\Hub\Editor\6000.0.26f1\Editor\Data\Managed\UnityEngine\UnityEngine.UIModule.dll" Private="true" />
</ItemGroup>


</Project>

The problem comes from the fact that NCRUNCH builds this CSPROJ file internally. It is missing the UnityEngine.CoreModule.dll, Physics2DModule and UIModule entirely.. only including the UnityEngine.UL.dll

Thanks in advance


<Project DefaultTargets="Build;NCrunchOutputDataQuery" Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="C:\Users\PC\AppData\Local\NCrunch\22052\6\_ncrunchreferences\UnityEngine.UI.dll">
<Private>true</Private>
</Reference>
</ItemGroup>
<Target Name="NCrunchOutputDataQuery" DependsOnTargets="">
<Message Text="#Expression_4066789ab4e34b45ad122e1d11f4602d=$(OutDir)$(TargetName)$(TargetExt)" />
<Message Text="#Expression_a2a404feb43745c5ac8939bb49fbefc9=$(Configuration)" />
<Message Text="#Expression_ba4025a09dd2496fa1c2880c0f5d8bf3=$(TargetName)" />
<Message Text="#$TargetFrameworkDirectory=;$(TargetFrameworkDirectory)" />
<Message Text="#ReferencePath=;@(ReferencePath)" />
<Message Text="#ReferenceCopyLocalPaths=;@(ReferenceCopyLocalPaths)" />
<Message Text="#TargetPathWithTargetPlatformMoniker=;@(TargetPathWithTargetPlatformMoniker)" />
<Message Text="#CopiedFiles_SourceItemsToCopyToOutputDirectoryAlways=@(_SourceItemsToCopyToOutputDirectoryAlways)|@(_SourceItemsToCopyToOutputDirectoryAlways->'$(OutDir)%(TargetPath)')" Condition="'@(_SourceItemsToCopyToOutputDirectoryAlways->'$(OutDir)%(TargetPath)')'!=''" />
<Message Text="#CopiedFiles_SourceItemsToCopyToOutputDirectory=@(_SourceItemsToCopyToOutputDirectory)|@(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')" Condition="'@(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')'!=''" />
<Message Text="#CopiedFilesAllItemsFullPathWithTargetPath=@(AllItemsFullPathWithTargetPath)|@(AllItemsFullPathWithTargetPath->'$(OutDir)%(TargetPath)')" Condition="'@(AllItemsFullPathWithTargetPath->'$(OutDir)%(TargetPath)')'!=''" />
</Target>
<PropertyGroup>
<ProjectAssetsFile>C:\Users\PC\AppData\Local\NCrunch\22052\6\Vectrosity\obj\project.assets.json</ProjectAssetsFile>
</PropertyGroup>
</Project>




Remco
#2 Posted : Sunday, March 30, 2025 7:16:22 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 975 times
Was thanked: 1313 time(s) in 1218 post(s)
Hi, thanks for sharing this problem.

The root issue here is the resolution path for the Unity DLLs. Under NCrunch, assemblies being referenced from Program Files are considered to be magical SDK references that exist globally on the machine and shouldn't be copied to the workspace. This likely has implications for your build system.

To work around this, I'd suggest copying the files to another area of your disk and referencing them from there.
1 user thanked Remco for this useful post.
BrilliantSkies on 3/30/2025(UTC)
BrilliantSkies
#3 Posted : Sunday, March 30, 2025 8:02:19 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/16/2024(UTC)
Posts: 4
Location: United Kingdom

Thanks: 2 times
Thanks for the reply. I REALLY appreciate you getting back so quickly on a Sunday.
What you are saying certainly tracks in terms of which of my employees have been able to get NCRUNCH working and which haven't.. and when I move the file to another folder it certainly does work.

But... Isn't this just a bug in NCRUNCH however? Sure, my DLLs exist in program files... but if they are not included in the CSPROJ that NCRUNCH makes then the code cannot compile and NCRUNCH cannot run tests...
Is there anyway to turn off this behaviour?

Just for a bit of explanation I'm using Unity game development engine and I have a Nuget package I use called Unity3D that basically automatically points the CSPROJ to the game engine DLLs. I assumed that it was some interplay between Unity3D and NCRUNCH that was causing an issue hence directly putting in the locations of the DLLS into the CSPROJ. I was then extremely surprised to find NCRUNCH still could not run... I've explicitly told it where my DLLs are (and set Private=true) and still it cannot build.

On my old machine my unity installations are at F:/UNITY INSTALLATIONS/
On my new machine they are installed into the Unity HUB in program files.
Several colleagues have had this issue in the past and given up on NCRUNCH but I'm a firm believer in it
But honestly without you telling me this about program files I would never have guessed that this was the issue.

I'd rather not have to install unity under a different location
Remco
#4 Posted : Sunday, March 30, 2025 9:01:42 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 975 times
Was thanked: 1313 time(s) in 1218 post(s)
The behaviour here goes way back to the early days of NCrunch, though I expect there may still be area of the toolset where this still applies.

Basically there are/were build tasks that would include references to system assemblies (which were inside Program Files), and if we copied these into the workspace or introduced assembly references directly into the workspace project, it would cause the build to fail with obscure errors. MSBuild is unfortunately full of this sort of thing, particularly when you imagine trying to support every major toolset released in the last 20 years.

So it's like this for a reason. The central issue is that it isn't easy to arbitrarily tell the difference between which assemblies should be explicitly referenced, and which should be implicitly referenced. Using their root directory has worked pretty well until Unity decided to do something different.

I'll take a look to see if there is something I can do to resolve this problem, but it would require a code change and there is a lot of work in the pipe at the moment. Probably I'll just whitelist any assembly with Unity in the name. For the time being, I recommend moving the assemblies as a workaround.
1 user thanked Remco for this useful post.
BrilliantSkies on 3/30/2025(UTC)
BrilliantSkies
#5 Posted : Sunday, March 30, 2025 9:05:03 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/16/2024(UTC)
Posts: 4
Location: United Kingdom

Thanks: 2 times
I've moved the installation and now all working.

Thanks a lot for your help today
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.058 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download