Can I use .fakes file to speed compile time?

64 views Asked by At

Including large libraries takes a long time generating a huge obj\Debug\Fakes\nycbmcs\f.cs.

I know I can limit the scope of the fakes by

<StubGeneration>
<Clear />
<Add Namespace="My.Huge.Assembly.MyNamespace!" />
</StubGeneration>

Referencing anything outside My.Huge.Assembly.MyNamespace will cause a compile error, however it still generates the same sized .cs file and takes just as long.

There is a FakesAssemblies*.fakesconfig that appears to list everything that gets generated, however if I edit it, it gets overwritten.

I do realize I can save the assembly and/or the other files that get generated, but this is a less than ideal solution. I have to worry about copying them between machines, and occasionally do need to generate one, which takes forever.

1

There are 1 answers

0
Brad On

Both

<StubGeneration>
    <Clear />
</StubGeneration>

and

<ShimGeneration>
    <Clear />
</ShimGeneration>

are required to avoid importing default fakes for everything. Just including StubGeneration, for example, means it will generate all possible shims.