I have followed Davids method and it works well for simple cases , unlike make files people very rarely modify/create msbuild files themselves ( except for very simple pre and post build instructions in projects) .
What to use really depends on what your trying to do . Creating C# files which are then parsed as normal is often done with C4 templates this is much easier it is quite extensive and not just 1:1 . Creating C# files is pretty easy but adding them to a project can be a pain especially if they need to be user edited , you can change project files dynamically but then you get anoying project file has changed reload messages so you need to go through the VS API.. the VS API is big and wont work on non VS which is another reason C4 is often used . Do you want something like type script where a higher level language creates jscript files ? If so this may help <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScriptSourceMap> --sourcemap</TypeScriptSourceMap> </PropertyGroup> <Target Name="BeforeBuild"> <Message Text="Compiling TypeScript files" /> <Message Text="Executing tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" /> <Exec Command="tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" /> </Target> This can be put in a project template . Typescript to js is done better with WebEssentials but it uses the VS API and when you change a type script file it automatically ensures the js file is up to date and in the solution ( it compiles every time you save) .. When you build it just compiles the js and the type script files are marked with ignore. I have used NAnt and Cmake for complex requirements but prefer project files, they dont create toolchain pain . Ben On Sat, Oct 5, 2013 at 7:44 AM, david j <[email protected]> wrote: > I find this painful as well. You can easily launch pre and post events > with msbuild, but making those tools platform and tree location independent > is a bit of a pain. Likewise, getting the generated C# files into the build > requires extra steps because of C# integrated compile and link (compared to > c and make files). > > The strategy I use is msbuild/xbuild with pre/post events that are CLR > program "sub projects" so they are portable without more toolchain pain. (I > use this strategy for XML/xslt based code templating, for example) I > manually add the generated C# to the csproj. > > Another strategy (which i have not tried) is to use NAnt. > > http://developer.empinia.org/empinia/HowToUseNant > > sent via mobile > On Oct 4, 2013 3:05 PM, "Sandro Magi" <[email protected]> wrote: > >> Pre-build events are easy in msbuild, but they're essentially just a >> batch script with various environment variables like I said. You can also >> write custom msbuild tasks [1,2], but I've never needed to dig in that >> deeply. >> >> Sandro >> >> [1] >> http://msdn.microsoft.com/en-**us/library/t9883dzc.aspx<http://msdn.microsoft.com/en-us/library/t9883dzc.aspx> >> [2] >> http://msdn.microsoft.com/en-**us/library/vstudio/z7f65y0d.**aspx<http://msdn.microsoft.com/en-us/library/vstudio/z7f65y0d.aspx> >> >> On 04/10/2013 3:11 PM, Sandro Magi wrote: >> >>> I believe batch scripts and T4 templates [1] are the most common ways of >>> dealing with code generation that isn't inherently supported by Visual >>> Studio (ie. design time tools). >>> >>> Sandro >>> >>> [1] >>> http://msdn.microsoft.com/en-**us/library/vstudio/bb126445.**aspx<http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx> >>> >>> On 04/10/2013 2:14 PM, Jonathan S. Shapiro wrote: >>> >>>> I'm struggling with something fairly trivial, and would appreciate >>>> assist. >>>> >>>> The Visual Studio build system is not (historically, at least) very >>>> good about building /inputs/. So for example, if you have a parser >>>> generator that generates a C-sharp program, that's a pain to do. I'm >>>> actually using Xamarin Studio, which seems to follow the same sort of >>>> practice. >>>> >>>> How do people who use such tools integrate them into their project >>>> build systems properly? >>>> >>>> Thanks >>>> >>>> >>>> Jonathan >>>> >>>> >>>> ______________________________**_________________ >>>> bitc-dev mailing list >>>> [email protected] >>>> http://www.coyotos.org/**mailman/listinfo/bitc-dev<http://www.coyotos.org/mailman/listinfo/bitc-dev> >>>> >>> >>> >>> >>> >>> ______________________________**_________________ >>> bitc-dev mailing list >>> [email protected] >>> http://www.coyotos.org/**mailman/listinfo/bitc-dev<http://www.coyotos.org/mailman/listinfo/bitc-dev> >>> >> >> >> >> _______________________________________________ >> bitc-dev mailing list >> [email protected] >> http://www.coyotos.org/mailman/listinfo/bitc-dev >> >> > _______________________________________________ > bitc-dev mailing list > [email protected] > http://www.coyotos.org/mailman/listinfo/bitc-dev > >
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
