-
Notifications
You must be signed in to change notification settings - Fork 2
Calling AutoImplement During a Build
I have a project where I want to reference code created by AutoImplement. For simplicity, I decide that I want that project to own the generated code. So I import AutoImplement from nuget package manager, and add the following pre-build event to the project:
if not exist $(ProjectDir)generatedCode mkdir $(ProjectDir)generatedCode
$(SolutionDir)packages\HavenSoft.AutoImplement.1.1.0\AutoImplement "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" ICommand
move /Y StubCommand.cs $(ProjectDir)generatedCode
Then, in my project, I add generatedCode\StubCommands.cs to the source list. Note that you can tell your source control to ignore everything in the generatedCode folder.
You can replace "System, Version...e089" with whatever assembly you want that has the interface you want to implement, even if it's another project from the same solution.
Notice that I'm only copying StubCommand.cs, because that's the only one I actually needed. The rest of the generated code will appear in the bin
folder next to your projects other output. You can add a delete command if you want, but it isn't needed.