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:
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)
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?
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.
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.
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.
SomeGuy 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?
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?
SomeGuy 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.