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

Notification

Icon
Error

Nuget Restore Error
Anthony.Carl
#1 Posted : Thursday, December 22, 2011 3:59:27 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/22/2011(UTC)
Posts: 1
Location: PA

NCrunch can't build solutions with Nuget Package Restore enabled.

Code:
[10:37:32.7169-BuildTask-50] ERROR (Compilation): Chatham.Tools.TcDgml: C:\Users\tcarl\AppData\Local\NCrunch\768\1\.nuget\nuget.targets (39): Unable to locate 'C:\Users\tcarl\AppData\Local\NCrunch\768\1\.nuget\nuget.exe'


To reproduce:
Enable Nuget Restore per: http://docs.nuget.org/do...out-committing-packages
Enable NCrunch for the solution
Error appears in Processing Queue

Other Thoughts:
As part of enabling Restore, Nuget adds a conditional statement to set the $(SolutionDir) if it is not set to the Project File. This value it sets is relative. So when NCrunch is building, it is looking in a directory relative to whatever current/working directory NCrunch is in instead of the actual Project Driectory. Not sure if this as simple as changing the current/working directory of NCrunch when it is building.

I experienced an issue with the $(SolutionDir) when I added it to TeamCity to build. By default, Nuget sets it to ..\..\<DirectorySolutionIsIn> (in my case ..\..\TcDgml). This is bad because I don't check out the parent directory of my solution, I check out only the solution directory. I changed this value to ..\ and that fixed the error in TeamCity.
Remco
#2 Posted : Thursday, December 22, 2011 9:20:01 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Anthony,

Thanks for posting! My first guess here is that NCrunch is unaware of some of the Nuget dependencies and is therefore neglecting to copy them to the workspace it uses to build your project.

NCrunch has a configuration option (AdditionalFilesToInclude) that allows you to manually inform it of files that need to be copied to the workspace. Does specifying your nuget resources with this option make any difference for you?


Cheers,

Remco
1 user thanked Remco for this useful post.
Rory.Adams on 12/23/2011(UTC)
Rangoric
#3 Posted : Friday, December 23, 2011 4:20:28 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/20/2011(UTC)
Posts: 5

Was thanked: 1 time(s) in 1 post(s)
In the NCrunch Configuration, for each project that has NuGet resources to restore.

You need to add the following line to the AdditionalFilesToInclude:
../.nuget/**.*
(Or however you can describe going from the project file, to the .nuget directory)
Remco
#6 Posted : Wednesday, February 1, 2012 12:15:10 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
For anyone interested, the new version of NCrunch just released (1.37b) will auto-configure for Nuget package restore, so it should no longer be necessary to follow the above manual steps if you are up-to-date with NCrunch.
alastairs
#7 Posted : Monday, April 9, 2012 8:30:31 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco

I'm still seeing this issue in v1.38b. My setup may be a little strange: I run VS 2010 and 11 beta inside a Windows 7 VM on Mac OS X. My code is hosted on my Mac's hard disk, so is accessed in the VM via a mapped network drive. When I enable NCrunch on a solution with NuGet Package Restore enabled, I see this same error message, that .nuget\nuget.exe cannot be found:

Quote:
C:\Users\Administrator\AppData\Local\NCrunch\4136\27\.nuget\nuget.targets (39): Unable to locate 'C:\Users\Administrator\AppData\Local\NCrunch\4136\27\.nuget\nuget.exe'


When I manually inspect that folder, the .targets file has been successfully copied (as is perhaps obvious from the error message above), but neither the .exe nor the .config files have been copied.

I've tried the manual work around (admittedly at the solution level, not sure if that makes a difference) to no avail. Is there any more information I can send through, a log file or something?

Cheers

Alastair
Remco
#8 Posted : Monday, April 9, 2012 9:40:15 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Alastair,

Are you able to share the nuget configuration inside the .proj file that's causing the problem? (copy/paste of the XML would be great). It's possible that NCrunch isn't detecting your nuget configuration properly and is failing to pick up the files automatically.

Note that you can still work around this by making sure the Nuget resources are within your 'additional files to include' for any projects that use them - though I am wondering why the auto configuration has failed for you.
alastairs
#9 Posted : Monday, April 9, 2012 9:56:48 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
Thanks Remco. It seems to be every project file that fails to build under NCrunch, so here's one chosen at random from the current solution. The only line mentioning NuGet was:

Quote:
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />


But as I say, the .targets file was copied successfully.

I mentioned that the "Additional files" workaround hadn't worked, but I applied it at the solution level in the hope that each project would then pick up the file automatically. Do I instead need to apply it to every project?

Thanks again

Alastair
Remco
#10 Posted : Monday, April 9, 2012 11:59:54 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
This is interesting - it looks as though your Nuget is performing package restore by default (even though it hasn't been configured at all in your project).

The additional files configuration option should work at both project level and solution level. If you're specifying it at solution level, make sure you make it relative to your solution file. You can check whether the configuration setting is working correctly by right-clicking on a failed project build in the Tests Window, choosing Advanced->Browse to workspace, then inspecting the workspace to see if it contains the Nuget files at the correct relative path.
alastairs
#11 Posted : Tuesday, April 10, 2012 7:54:25 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
I'm not sure that's a correct diagnosis: the NuGet.targets file is being included, and it's clear from the error message reported that the NuGet build targets are being run: the error is thrown from within NuGet.targets, and relates to a non-existent NuGet.exe. I re-ran "Enable NuGet Package Restore" from VS2010, and it made no changes to my project files.

Based on your comments on the manual workaround, this isn't working either: NCrunch is simply refusing to copy the NuGet.exe and NuGet.Config files from the solution directory: the .nuget directory in the NCrunch workspace only contains nuget.targets. I've specified ".nuget\*.*" as AdditionalFilesToInclude at the solution level; have I got the syntax wrong (e.g., do I need to include a leading backslash, or ".\" perhaps)?
Remco
#12 Posted : Tuesday, April 10, 2012 9:15:08 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
NCrunch is able to easily detect the .targets file as being included using your project file's <import> tag. However, the resources used by the targets file cannot be automatically detected by NCrunch (hence the need to define them with the additional files to include).

Normally NCrunch should determine this automatically, and I'm concerned that attempting to specify the paths isn't working for you with both the solution level configuration option or the project level configuration option. The syntax is normally quite simple, for example .. with a solution file at:

c:\mysolution\solution.sln

..and the nuget files at:

c:\mysolution\.nuget\

You would specify:

.nuget\**.*

I wonder if the leading '.' may be messing with the paths, so one thing to try would be:

..\mysolution\.nuget\**.*

Still, this should have worked by now. I haven't seen things go so wrong with path resolution on any of the later NCrunch builds, so I suspect there is something with your setup that may be triggering a failure. It would be great if you could submit a bug report using the 'NCrunch' menu so I can check for anything out of place.
alastairs
#13 Posted : Wednesday, April 11, 2012 3:43:15 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
Ah, I see, ok. I had thought that perhaps the syntax was wrong (I was using .nuget\*.* rather than .nuget\**.* as you suggested), but this didn't make any difference, and neither did the suggestion to use ..\solutiondir\.nuget\**.*.

I'll submit a bug report as requested, and hopefully that will provide more information.
Remco
#14 Posted : Thursday, April 12, 2012 1:21:03 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks. I've looked through the bug report though with the size of your project I was only able to analyse the tail end of the log. If you're able to submit a bug report just after NCrunch is initialised (and while your projects are just starting to build), that would be really helpful.

Also, would you be able to share your nuget version number?
1 user thanked Remco for this useful post.
alastairs on 4/12/2012(UTC)
alastairs
#15 Posted : Thursday, April 12, 2012 9:36:18 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
Thanks Remco. Unfortunately I'm away from this machine for a couple of days, but I should hopefully be able to do a new bug report on Sunday.

I recently upgraded to NuGet 1.7, but I saw the same behaviour with 1.6.
Remco
#16 Posted : Friday, April 13, 2012 3:19:08 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks. It would be great if you're able to rule out any possible reasons for why this is failing.. For example, you mentioned that you are accessing the solution via a network share. Does the solution work if you copy it to the local drive of the VM? Also, do any other solutions using Nuget work correctly for you?
alastairs
#17 Posted : Sunday, April 15, 2012 4:42:38 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
Just had another look at this, and have submitted a fresh bug report, this time from VS2010 and a different solution.

I see the same behaviour if I copy the solution directory to the Virtual Machine's hard disk. One thing the two copies (remote and local) have in common is the .nuget directory is a hidden directory; does that make a difference to NCrunch's operation?
Remco
#18 Posted : Monday, April 16, 2012 2:06:59 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Yes - this makes a very big difference!

NCrunch is programmed to ignore hidden directories because they are often used by VCS software to store often locked data adjacent to the VS solution.

I would expect that your solution will start working correctly as soon as you flag your .nuget directory as non-hidden.

I'll make a note to adjust future revisions of NCrunch to still consider the .nuget directory, even if it is hidden.. just in case others also experience this problem.

Good find.


Cheers,

Remco
1 user thanked Remco for this useful post.
alastairs on 4/16/2012(UTC)
alastairs
#19 Posted : Monday, April 16, 2012 8:06:20 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
That explains it then! Unix OSs treat files and directories named with a leading . as hidden files and directories, and clearly Parallels (or more likely Samba) is exposing those files and directories as hidden on the Windows share too. I'll have a poke around in my config files to see if I can fix it on my machine as well.

It would still be great to get the fix into some future release as well, so that it just works "out of the box".
Remco
#20 Posted : Monday, April 16, 2012 9:07:11 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Something that may let you work around the problem could be to move the nuget files out of this directory and into a different one. I'm not sure if this will have any impact on your installation of future Nuget packages, but in theory it should work just the same. You'd need to adjust your .proj files to point to a different file path for the nuget target.
alastairs
#23 Posted : Thursday, June 7, 2012 9:26:53 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 54
Location: Cambridge, UK

Thanks: 22 times
Was thanked: 4 time(s) in 4 post(s)
Just wanted to drop a quick note to say thanks for fixing this up in the 1.39 build. It's greatly appreciated, and I'm really happy to be able to use this great tool on my laptop again!
1 user thanked alastairs for this useful post.
Remco on 6/7/2012(UTC)
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.131 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download