I wrote a little MSBuild script to build my project on multiple versions. When I run it from VS2012 Command Prompt it works, I don't get any errors or exceptions. However when I compare the produced assemblies, they are identical. Is there something wrong in my script?
<Target Name="Build">
<MSBuild Projects=".\WcfClientBase\WcfClientBase.csproj"
Properties="Configuration=Release;OutputPath=.\BuildArtifacts\net45;TargetFrameworkVersion=v4.5" />
<MSBuild Projects=".\WcfClientBase\WcfClientBase.csproj"
Properties="Configuration=Release;OutputPath=.\BuildArtifacts\net40;TargetFrameworkVersion=v4.0" />
<MSBuild Projects=".\WcfClientBase\WcfClientBase.csproj"
Properties="Configuration=Release;OutputPath=.\BuildArtifacts\net35;TargetFrameworkVersion=v3.5" />
</Target>
I have VS2012 Professional installed. I also noticed .NET 4.5 doesn't have its own MSBuild.exe. Is it using the one from version 4.0?
Update
I built it with Visual Studio for each version and all assemblies are different. There is something wrong with my script. I deliberately mistyped the TargetFrameworkVersion parameter name but it still built and produced same outputs. Maybe it's unable to override that parameter from the project file or there are other parameters I am missing. Any more ideas?
You also need to customize IntermediateOutputPath property, otherwise all 3 flavors share the same intermediate directory obj\Release
. Try this:
<Target Name="Build">
<MSBuild Projects="WcfClientBase\WcfClientBase.csproj"
Properties="Configuration=Release;OutputPath=BuildArtifacts\net45\;IntermediateOutputPath=obj\Release\net45\;TargetFrameworkVersion=v4.5" />
<MSBuild Projects="WcfClientBase\WcfClientBase.csproj"
Properties="Configuration=Release;OutputPath=BuildArtifacts\net40\;IntermediateOutputPath=obj\Release\net40\;TargetFrameworkVersion=v4.0" />
<MSBuild Projects="WcfClientBase\WcfClientBase.csproj"
Properties="Configuration=Release;OutputPath=BuildArtifacts\net35\;IntermediateOutputPath=obj\Release\net35\;TargetFrameworkVersion=v3.5" />
</Target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With