This commit is contained in:
Johan Laanstra 2018-01-30 18:11:34 -08:00
Родитель 93efae99d8
Коммит 58aa7699a3
2 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -5,7 +5,7 @@ This document is targeted for developers who would like to understand and potent
## Build & Code Generation
SimpleStubs used Roslyn to generate stubs. The code is generated during the build (right before the build actually).
When SimpleStubs NuGet package is installed to a given project, the [Etg.SimpleStubs.targets](https://github.com/Microsoft/SimpleStubs/blob/master/Targets/Etg.SimpleStubs.targets) file is installed and imported in the `ProjectName.nuget.targets` file (which gets added to the target project). The [Etg.SimpleStubs.targets](https://github.com/Microsoft/SimpleStubs/blob/master/Targets/Etg.SimpleStubs.targets) file contains a `BeforeBuild` task that executes the [GenerateStubsTask](https://github.com/Microsoft/SimpleStubs/blob/master/src/SimpleStubs.CodeGen/Tasks/GenerateStubsTask.cs) visual studio Task and writes the output to the `"$(ProjectDir)Properties\SimpleStubs.generated.cs"` file. This Task calls the [SimpleStubsGenerator](https://github.com/Microsoft/SimpleStubs/blob/master/src/SimpleStubs.CodeGen/CodeGen/SimpleStubsGenerator.cs) which walks through all dependent projects and generate corresponding stubs.
When SimpleStubs NuGet package is installed to a given project, the [Etg.SimpleStubs.targets](https://github.com/Microsoft/SimpleStubs/blob/master/Targets/Etg.SimpleStubs.targets) file is installed and imported in the `ProjectName.nuget.targets` file (which gets added to the target project). The [Etg.SimpleStubs.targets](https://github.com/Microsoft/SimpleStubs/blob/master/Targets/Etg.SimpleStubs.targets) file contains a `BeforeBuild` task that executes the [GenerateStubsTask](https://github.com/Microsoft/SimpleStubs/blob/master/src/SimpleStubs.CodeGen/Tasks/GenerateStubsTask.cs) visual studio Task and writes the output to the `"$(IntermediateOutputPath)SimpleStubs.generated.cs"` file. This Task calls the [SimpleStubsGenerator](https://github.com/Microsoft/SimpleStubs/blob/master/src/SimpleStubs.CodeGen/CodeGen/SimpleStubsGenerator.cs) which walks through all dependent projects and generate corresponding stubs.
## Method and Property Stubbers

Просмотреть файл

@ -8,9 +8,7 @@ To install SimpleStubs, simply install the `Etg.SimpleStubs` NuGet package to yo
Once installed, SimpleStubs will create stubs for all interfaces (`public` interfaces and optionally `internal` interfaces) in all referenced projects.
The generated stubs will be added to the `Properties\SimpleStubs.generated.cs` file and compiled as part of the build process. Because the stubs are generated, modifying the stubs manually has no effect (if you really want to modify a stub, copy it to a different file).
**Important note for UWP**: Because of a limitation in NuGet support for UWP (see discussion [here](https://github.com/NuGet/Home/wiki/Bringing-back-content-support,-September-24th,-2015)), the `Properties\SimpleStubs.generated.cs` file will not be automatically added to UWP projects and must be manually added (simply add the file to the `Properties` folder of your test project).
The generated stubs will be automatically generated in the intermediate output path and compiled as part of the build process. Because the stubs are generated, modifying the stubs manually has no effect (if you really want to modify a stub, copy it to a different file).
## Api