How to remove .ncrunchproject files (or any other files that are similar) from .Net Core project/solution

275 Views Asked by At

I have added NCrunch to my .Net Core solution and now this file was added to all projects:

ProjectName.v3.ncrunchproject

I have added this to gitignore so it's not going to source control, but how can I remove it from Project?

There is an option of excluding this file explicitly in each and every project by either clicking Exclude in menu or adding it manually in .csproj file. I hope though that a better solution exists.

1

There are 1 best solutions below

1
Peska On

One way of solving this is to modify DefaultItemExcludes in sdk project props. For example go to:

C:\Program Files\dotnet\sdk\<version>\Sdks\Microsoft.NET.Sdk.Web.ProjectSystem\build\netstandard1.0

and modify Microsoft.NET.Sdk.Web.ProjectSystem.props.

Find something like:

<DefaultItemExcludes>$(DefaultItemExcludes);**\node_modules\**;node_modules\**</DefaultItemExcludes>

and change it to:

<DefaultItemExcludes>$(DefaultItemExcludes);**\node_modules\**;node_modules\**;**\*.ncrunchproject</DefaultItemExcludes>

After Visual Studio restart it should be automatically excluded from your project. This is not a perfect solution, because you will have to do it for every project type and sdk you have.