A slightly improved version / approach is to use the following in a generic .targets file:
<Choose> <When Condition=" '_$(VisualStudioVersion)'=='_11.0' " > <PropertyGroup> <CPPTasks>V110\Microsoft.Build.CPPTasks.Common.v110.dll</CPPTasks> </PropertyGroup> </When> <Otherwise> <PropertyGroup> <CPPTasks>Microsoft.Build.CPPTasks.Common.dll</CPPTasks> </PropertyGroup> </Otherwise> </Choose>
Then in your .csproj you can do the following:
<UsingTask TaskName="XSD" AssemblyFile="$(VCTargetsPath)$(CPPTasks)" />
Please note that this was tested in VS2010, VS2011, VS2013 (DLL names switch back and forth depending on the installed version of VS .: (
The improvement is that only one place contains logic for the correct path and name of the DLL, and not the individual .csproj files.
source share