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

Notification

Icon
Error

Build error with basic .NET Standard class library
SomeGuy
#1 Posted : Wednesday, June 28, 2017 3:37:44 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/22/2016(UTC)
Posts: 9

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
Hi,

I have a class library in vs2017/msbuild15 project format that targets both net461 and netstandard13. The test project targets net461. I'm running ncrunch 3.9.0.1.

The source project builds fine for the net461 target and the tests are run, but for the netstandard13 target, I get the following build error:

Code:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\<user>\.nuget\packages\Microsoft.NETCore.App'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.Directory.GetDirectories(String path)
   at nCrunch.Common.IO.DirectoryPath.GetDirectories(String wildcardSpec)
   at nCrunch.Core.PlatformTypes.DotNetCorePlatformType.GetRequiredPackageDependencies()
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(ProcessorArchitecture , String )
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)



sample project that illustrates the problem: https://www.dropbox.com/...tandardLibrary.zip?dl=0
Remco
#2 Posted : Wednesday, June 28, 2017 3:42:48 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

This problem appears to be related to the configuration on your machine rather than anything specific to the project or solution.

How is it that you are able to build/run .NET Core and .NET Standard without the Microsoft.NETCore.App installed? Have you configured your machine to use a different root path for your stored Nuget packages?
SomeGuy
#3 Posted : Wednesday, June 28, 2017 3:50:03 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/22/2016(UTC)
Posts: 9

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
This is not local to my machine as all developers on my team are seeing this. My downloaded nuget packages are going to C:\Users\<user>\.nuget\packages as expected, but I don't have an explicit reference to Microsoft.NETCore.App in my project. Does the sample project work for you?

This is where I have Microsoft.NETCore.App on my machine.

Remco
#4 Posted : Wednesday, June 28, 2017 3:57:05 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
My understanding is that Microsoft.NetCore.App should normally be installed as a Nuget package in your local packages directory (C:\Users\<user>\.nuget\packages).

Your configuration seems to prove this to be a false assumption.

Can you tell me more about your setup? How was .NET Core originally installed on your machine? Have you installed any preview builds?

The sample project does work on my machine, though I have this package installed in the Nuget packages directory.
SomeGuy
#5 Posted : Wednesday, June 28, 2017 4:01:34 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/22/2016(UTC)
Posts: 9

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
I installed it with the RTM VS2017 installer, and never installed any of the preview builds of VS2017 or .net core before that. The same goes for the other developers on my team. I'm guessing maybe you happen to have it installed in the nuget packages directory, but it isn't necessarily installed there for everyone. If you manually remove/rename it, I think you will see what I see.
Remco
#6 Posted : Wednesday, June 28, 2017 4:05:19 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
SomeGuy;10706 wrote:
I installed it with the VS2017 installer, and never installed any of the preview builds before that. The same goes for the other developers on my team. I'm guessing maybe you happen to have it installed in the nuget packages directory, but it isn't necessarily installed there for everyone. If you manually remove/rename it, I think you will see what I see.


I think you're probably right here. If you've never introduced a reference to this package from your own projects (which is possible if you only use NetStandard), then VS would never have downloaded it, so it wouldn't be in the packages directory.

A simple way to get you working may well be for you to create a .NET Core project and build this in VS. The package will then get restored and NCrunch should proceed with your real solution without complaint. Could you confirm if this works for you?
SomeGuy
#7 Posted : Wednesday, June 28, 2017 4:15:06 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/22/2016(UTC)
Posts: 9

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
I can confirm that this makes the build error go away. Perhaps ncrunch should not assume this package exists in the nuget package directory and should instead try to reference it from the installed location under C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\Microsoft.NETCore.App. Is that something you can look at for the next version?
Remco
#8 Posted : Wednesday, June 28, 2017 4:18:46 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
SomeGuy;10710 wrote:
I can confirm that this makes the build error go away. Perhaps ncrunch should not assume this package exists in the nuget package directory and should instead try to reference it from the installed location under C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\Microsoft.NETCore.App. Is that something you can look at for the next version?


I agree there needs to be a fix here. In this case, the code responsible for the fault is actually related to grid processing; it's trying to pin down the likely dependencies that need to be copied to the grid node. Since your use case doesn't actually require the package anyway, a simple exists check is probably sufficient to solve this.

Thanks for confirming that the workaround behaves as expected. I'll include a fix for this in the next NCrunch build.
1 user thanked Remco for this useful post.
SomeGuy on 6/28/2017(UTC)
SomeGuy
#9 Posted : Wednesday, June 28, 2017 4:23:42 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/22/2016(UTC)
Posts: 9

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
Awesome. Thanks for the prompt support!
1 user thanked SomeGuy for this useful post.
Remco on 6/28/2017(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.048 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download