Using a nested .csproj file for custom build step

It looks like you can add a .csproj file as an item to your Visual Studio project, and it will be executed during the project build. I.e. Main.csproj may contain foo.cs, bar.cs, and custom.csproj as items, and every time you build Main.csproj it will invoke whatever build targets are in custom.csproj. Weird…

I found this by looking at someone else’s project that generated some source code files. I was trying to find where the custom build step for generating the files is. And there it was – inside a “nested” .csproj file, clearly written by hand.

Leave a Reply

Your email address will not be published. Required fields are marked *