I've been dealing with this issue at work, and I would really like to be able to use NCrunch, so I spent some time messing around :)
I've found what appears to be a workaround, but it makes me wonder if there is any way to make it a bit easier to maintain from NCrunch's side, or if this will fail at some point due to factors I'm failing to anticipate.
For my use-case, all intermediate output of each project in a solution must go to a directory named after the project, and grouped in a single directory. Due to MSBuild constraints, specifying BaseIntermediateOutputPath in the csproj file fails, see:
https://github.com/dotnet/msbuild/issues/1603. So we use a Directory.build.props file instead, but this causes issues for NCrunch due to the temporary project file it must create. We must also use `$(MSBuildProjectName)` instead of `$(ProjectName)` or `$(AssemblyName)`, as the latter are empty when resolved in the props file.
I have been able to make this work with a Directory.build.props file containing:
Quote:
<BaseIntermediateOutputPath Condition="'$(NCrunch)' != '1'">..\_base\$(Platform)-$(Configuration)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<IntermediateOutputPath Condition="'$(NCrunch)' != '1'">..\_obj\$(Platform)-$(Configuration)\$(MSBuildProjectName)\</IntermediateOutputPath>
<BaseIntermediateOutputPath Condition="'$(NCrunch)' == '1'">..\_base\$(Platform)-$(Configuration)\$(NCrunchProjectName)\</BaseIntermediateOutputPath>
<IntermediateOutputPath Condition="'$(NCrunch)' == '1'">..\_obj\$(Platform)-$(Configuration)\$(NCrunchProjectName)\</IntermediateOutputPath>
`$(NCrunchProjectName)` is a custom build property that must be added for each project and set to that project's name. Additionally `Use build configuration` and `Use build platform` must be set manually, as `$(Platform)-$(Configuration)` is resolved to simply `-` by NCrunch by default.
I have 2 questions then:
1. Can we avoid needing to set `$(NCrunchProjectName)` manually per project somehow? Perhaps with an NCrunch build property for `NCrunchOriginalProjectName` such as those listed here:
https://www.ncrunch.net/...crunch-build-properties.2. Can we make $(Platform)-$(Configuration) work out-of-the-box so we don't have to hardcode this in the NCrunch settings, but have it use whatever we have Visual Studio (in this case) set to?
I have a minimal repro to demonstrate this if that would be helpful, but I'm unsure how to share it.
Curious if you have any thoughts.