Build/Test Issues

`project.assets.json' not found. Run a NuGet package restore to generate this file.

Started by sjkirk on 6,376 views

I'm trying to use NCrunch with https://github.com/cwensley/Portable.Xaml and I'm getting the following error on all of the projects in the solution under ncrunch:

```
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file:
Assets file 'D:\projects\AvaloniaUI\Portable.Xaml\artifacts\obj\nCrunchTemp_e60e51a2-bb4d-4077-aefb-8187cee5205f\project.assets.json' not found. Run a NuGet package restore to generate this file.
at nCrunch.Compiler.ComponentAnalysisContext.()
at nCrunch.Compiler.ComponentAnalysisContext.AnalyseComponentBuild()
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
```

Any idea why this isn't working?

Edited

Hi, thanks for sharing this issue.

The problem here is being caused by the Directory.build.props file in the solution's root directory. This file overrides the BaseIntermediateOutputPath to a file that is derived from the project's file name. This interferes with NCrunch's ability to load the project, because NCrunch needs to produce a temporary project file (under a temporary name) to load data from the project. See here for more details.

The only way to resolve this is to avoid setting the BaseIntermediateOutputPath in your projects to the MSBuildProjectName property. Unfortunately the structure of the platform is such that there is no way we can make NCrunch work on a CPS based project that sets its BaseIntermediateOutputPath to the name of the project.
Thanks for the super-quick reply Remco!

I'll open an issue on the repository to see if there's a way to avoid setting BaseIntermediateOutputPath.

Thanks again!

Post a reply

Log in to reply.