andcoll;9161 wrote:
we have files that we need to include in the root of our repository, we've got a $(SRCROOT) env variable that points to this. So instead of ..\..\..\..\..\..\includedfile.xyz we'd prefer $(SRCROOT)\includedfile.xyz.
We've had issues where we've had to change a lot of ncrunchproject files after refactoring as the relative paths are now different.
We use these same env variables in our csproj files, it would be great if we could use them for ncrunch too.
Understood. At the moment NCrunch can't handle such a scenario with this setting, but it should be possible to use MSBuild instead.
MSBuild does work with environment variables, and NCrunch uses MSBuild to establish files it needs to include. It is possible to use this as an alternative to the Additional files to include setting.
For example, including the following in your project file should work:
<ItemGroup Condition="'$(NCrunch)' == '1'">
<None Include="$(SRCROOT)\includedfile.xyz" />
<None Include="$(SRCROOT)\IncludedDir\*.*" />
</ItemGroup>
I don't believe it's possible to include an entire directory tree using a single expression in MSBuild (others may correct me if there is a way to do this), so there may be some limitations with this approach.