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

Notification

Icon
Error

Generated csproj is missing assembly reference
rvgolovin
#1 Posted : Saturday, August 15, 2020 6:03:29 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/15/2020(UTC)
Posts: 3
Location: United States of America

Thanks: 1 times
Hello,
My NCrunch build is failing with missing assembly reference error. VS builds the project fine. The original project has this reference in this way:

<Reference Include="WebApiThrottle">
<HintPath>E:\NuCache\WebApiThrottle\lib\net45\WebApiThrottle.dll</HintPath>
</Reference>

There are many references like this in the original project and all of them but this one are making into the generated project in the NCrunch working directory.
Missing this reference in the generated project breaks NCrunch build.

What could make this reference to be excluded from the generated project?
Remco
#2 Posted : Sunday, August 16, 2020 12:14:50 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi, thanks for sharing this problem.

Generally, it's recommended to avoid absolute file path references like this one as it can cause problems with some things, like grid processing.

However, I've tried testing this with a simple scenario in which the assembly is stored on a different disk to the project file, and confirmed that NCrunch does still handle this scenario correctly by copying the file into the workspace and updating the reference in the generated file.

Is this file being referenced from inside a Nuget package directory that has been redirected to a different location? If so, there is a possible chance that NCrunch is considering the reference to actually be a Nuget package, in which case it would step away from trying to introduce the AssemblyReference inside the generated file because this is normally handled downstream by Nuget package references. If this is indeed the case, I recommend either replacing your Reference with a PackageReference or moving the file outside the Nuget package directory.
1 user thanked Remco for this useful post.
rvgolovin on 8/16/2020(UTC)
rvgolovin
#3 Posted : Sunday, August 16, 2020 2:29:01 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/15/2020(UTC)
Posts: 3
Location: United States of America

Thanks: 1 times
Thank you for the suggestion. If I place the reference in another folder it does indeed makes the build pass. However this is not an option for my build system.
I also can't add Package Reference to this project as this is prohibited by the build system. There are no Package References in this project.

The NuCache folder is the NuGet package cache folder with close to 2K packages in it. It's not a NuGet package install folder, but rather a separate cache that is shared by builds from different repositories.

This particular project has 25 references to other packages in this NuCache folder. Only one of them is not making it to the generated project.
I tried both relative and direct path in the reference. It did not make any difference.

Is there a way to turn this NuGet package smarts off for NCrunch?

I tried turning off "Auto-detect NuGet build dependencies", but it did not help.
Remco
#4 Posted : Sunday, August 16, 2020 3:51:30 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
I'm sorry, but I cannot think of a way to allow you to resolve this problem without changing your build system.

NCrunch sits on top of a very complex platform consisting of layers of interaction between Nuget and MSBuild. In broad terms, a reference to an assembly is either done via Nuget or it's done through a direct assembly reference. Somehow, you've managed to create a reference that is technically both things at the same time, and NCrunch does not have a way to handle such a situation.

If the reason you're not able to move this assembly is because of compatibility with builds outside of NCrunch, the best I can suggest would be to add an environment variable that is used to specify the location of the assembly. You can then set this to a different location under NCrunch using the Custom environment variables setting.

If you're using a system with a centralised cache of assembly references, many of which happen to also be Nuget packages, you could try splitting the centralised cache into two separate directories - one for Nuget package assemblies and one to contain non Nuget packages that are centrally referenced using AssembyReference. In this way, the assembly can stay located outside the configured Nuget package cache while still being centrally stored and addressed.
rvgolovin
#5 Posted : Sunday, August 16, 2020 7:25:00 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/15/2020(UTC)
Posts: 3
Location: United States of America

Thanks: 1 times
I worked around the problem for now by simply renaming the cache folder on my box. This is odd and does not ensure me some other project is not going to break in the similar way with new cache folder name. This build serves countless number of projects and is used by 2K+ developers. I'd like to get to the bottom of this issue if possible.

Here is more context. The cache folder has expanded NuGet packages in it and nothing else. This is how this build system consumes the NuGet packages.
Why some paths are ok and some not?
Why would NCrunch expects some assembly references would be taken care by Package Reference if none of the projects in the solution ever have Package References?
Any chance adding a feature to switch this NuGet reassignment off?

Remco
#6 Posted : Sunday, August 16, 2020 1:34:29 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Can you try setting the NUGET_PACKAGES environment variable on your machine to a different path to see if this makes any difference? (You'll need to restart VS before this will take effect).
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.050 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download