While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported

Original Comment


Tim Cartwright

# Reply

I found your article quite interesting, and decided to take it a step further by adding a build for each framework version with a single compile as an alternative to batching MSBuild. I wanted to do this so I could include these various builds into a nuget package. Here is how I did it:

In your default property group:

    <!--defaults, in case they add a build that does not match -->
    <!--4.0 build-->
    <AssemblyName Condition=" '$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Release' ">MultiBuild.v40</AssemblyName>
    <TargetFrameworkVersion Condition=" '$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Release' ">v4.0</TargetFrameworkVersion>
    <!--4.5 build-->
    <AssemblyName Condition=" '$(Configuration)' == 'Debug 4.51' OR '$(Configuration)' == 'Release 4.51' ">MultiBuild.v451</AssemblyName>
    <TargetFrameworkVersion Condition=" '$(Configuration)' == 'Debug 4.51' OR '$(Configuration)' == 'Release 4.51' ">v4.5.1</TargetFrameworkVersion>

Then either add a new AfterBuild event, or add the MSBuild elements to your existing AfterBuild:

Btw, don’t do this:

            <Target Name="AfterBuild">
                            <MSBuild Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " Projects="$(MSBuildProjectFile)" Properties="Configuration=Debug 4.51;PlatForm=AnyCPU" RunEachTargetSeparately="true" />
                            <MSBuild Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.51|AnyCPU' " Projects="$(MSBuildProjectFile)" Properties="Configuration=Debug;PlatForm=AnyCPU" RunEachTargetSeparately="true" />

In this case when you build either one, it would build the other. Then build the other one, then build the other… rinse,, repeat and you’ve created a build circular reference. With this technique I suggest all other builds triggering off the base Debug and Release build.


Richard Moss

# Reply


Thanks for the comment, that looks interesting. In the end I abandoned this approach after getting really annoyed with Visual Studio having multiple warnings about different references, although it became a moot point as I turned the library into a multi target nuget package after I decided to convert a great many of our libraries into private packages. I'm still a bit old school and really like my batch files too ;)

Thanks again for the comment!

Richard Moss