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

Notification

Icon
Error

Path to nuget cache?
moswald
#1 Posted : Tuesday, February 16, 2016 5:54:41 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/31/2012(UTC)
Posts: 16
Location: Austin, TX

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
I'm building a project that needs to include additional files. Prior to Nuget v3, I could point it to ../packages/refit/2.4.1/tools/*.*, but now the Nuget packages are stored in c:\users\moswald\.nuget\packages. I've tried changing the "additional files" path to %USERPROFILE%/.nuget/... but that doesn't work.
Remco
#2 Posted : Tuesday, February 16, 2016 9:59:08 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this.

It looks like we'll need to add support for environment variables in the 'Additional Files To Include' for this to work. I'll see if I can get this introduced. Thanks for making me aware of it.

An ugly work around would be to hard-code the path into the 'Additional files to include' setting. If you're sharing settings with other NCrunch users, you can create a new line in the setting for each user. If NCrunch detects the directory as missing, it simply won't try to include from it.
moswald
#3 Posted : Sunday, February 21, 2016 11:10:07 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/31/2012(UTC)
Posts: 16
Location: Austin, TX

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Whoops, your reply got sent to my spam folder.

Thanks for the tip about nCrunch ignoring missing folders. At least that way we get those tests back for now.
Remco
#4 Posted : Thursday, March 3, 2016 3:06:22 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
I've just revisited our solution to this issue, and realised that our solution doesn't really make sense in this context.

The Additional Files To Include is designed to allow you to include files in the workspace that a relatively referenced from your code or build logic.

But the Nuget package path above is referenced using an absolute path.

So an environment variable here won't help. NCrunch won't be able to do anything with the include because there is no relative structure that can fit this reference outside of the disk path it's already in.

I would expect that if you remove any attempt to include this nuget package using Additional Files To Include, NCrunch should still be able to build the project without issue. This is because any paths in the build logic pointing at the package will be pointing to an absolute path, and they will work regardless of whether the project is in a workspace or otherwise.

Is it possible that you encountered this issue by attempting to create an Additional Files To Include entry for the referenced package simply out of habit?

I note that storing packages in a global space (which Nuget v3 does) is likely to create problems when executing builds/tests on remote grid nodes that don't have the package installed. I'm currently investigating this issue.
moswald
#5 Posted : Thursday, March 3, 2016 4:54:14 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/31/2012(UTC)
Posts: 16
Location: Austin, TX

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
In this case, the nuget package comes with a tools subfolder with an executable inside that gets run as a pre-build step. Pre-nuget
3.0, the only way to get it working was to use the IncludeAdditionalFiles property.
Remco
#6 Posted : Thursday, March 3, 2016 4:56:47 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
moswald;8366 wrote:
In this case, the nuget package comes with a tools subfolder with an executable inside that gets run as a pre-build step. Pre-nuget
3.0, the only way to get it working was to use the IncludeAdditionalFiles property.


Understood. Is the Additional Files To Include setting needed now that you are running Nuget v3?
moswald
#7 Posted : Thursday, March 3, 2016 4:58:54 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/31/2012(UTC)
Posts: 16
Location: Austin, TX

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
I think so? It's definitely broken right now. :)

If you want, tomorrow I can put together a sample test suite and put it on GitHub for you to take a look at.
Remco
#8 Posted : Thursday, March 3, 2016 5:24:15 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
moswald;8368 wrote:
I think so? It's definitely broken right now. :)

If you want, tomorrow I can put together a sample test suite and put it on GitHub for you to take a look at.


It would be really great if you could do that. Sorry, I'm having a hard time understanding this one.
moswald
#9 Posted : Thursday, March 3, 2016 4:05:07 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/31/2012(UTC)
Posts: 16
Location: Austin, TX

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Remco
#10 Posted : Thursday, March 3, 2016 10:01:20 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks! The error message I receive from this code when testing it under the latest dev version of NCrunch is as follows:

System.InvalidOperationException: IExampleApi doesn't look like a Refit interface. Make sure it has at least one method with a Refit HTTP method attribute and Refit is installed in the project.
at Refit.RestService.For[T](HttpClient client, RefitSettings settings) in y:\code\paulcbetts\refit\Refit\RestService.cs:line 31
at Client.ApiFactory.CreateClient() in C:\Temp\nCrunchRefitAndNuget3-master\Client\IExampleApi.cs:line 31
at Client.Tests.SomeTests.ThisIsATest() in C:\Temp\nCrunchRefitAndNuget3-master\Client.Tests\SomeTests.cs:line 10

Is this the expected result of the code in its current state? It looks to be related to the endpoint/test. Is this the same problem you're experiencing, and can you confirm which version of NCrunch you're using?

I note that these projects are using project.json to reference their Nuget packages, so unless you're running an early build of 2.20, NCrunch will likely bomb out with a DNX error.
moswald
#11 Posted : Friday, March 4, 2016 4:06:21 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/31/2012(UTC)
Posts: 16
Location: Austin, TX

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Aha, I have it figured out. You were right, it didn't have anything to do with the nuget package itself. The build process knows about the nuget cache, and so nCrunch shouldn't need to do anything special.

However, nCrunch doesn't automatically copy the generated .nuget.targets file, and so the build process doesn't know about the "extra" steps.

To fix this particular case, add Client.nuget.targets to the "Additional Files to Include" list, and everything starts building properly. I'm around 95% sure that this is correct in all cases, too.
Remco
#12 Posted : Friday, March 4, 2016 4:15:31 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
moswald;8374 wrote:
Aha, I have it figured out. You were right, it didn't have anything to do with the nuget package itself. The build process knows about the nuget cache, and so nCrunch shouldn't need to do anything special.

However, nCrunch doesn't automatically copy the generated .nuget.targets file, and so the build process doesn't know about the "extra" steps.

To fix this particular case, add Client.nuget.targets to the "Additional Files to Include" list, and everything starts building properly. I'm around 95% sure that this is correct in all cases, too.


Gotcha! It looks like this file is referenced implicitly somehow - I can't find anything in the project XML that points directly to it .. so NCrunch just won't know about it. This should be easy to fix. Thanks for the nice analysis.
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.067 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download