PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Visual Studio/VSSDK/MSBuild/Microsoft.VsSDK.Common.targets

#
MSBuild | 187 lines | 96 code | 36 blank | 55 comment | 0 complexity | 222b787eace03da83a80dd76d9fb1e9d MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  2. <!--
  3. *************************************************************************
  4. Copyright (c) Microsoft Corporation. All rights reserved.
  5. This code is licensed under the Visual Studio SDK license terms.
  6. THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
  7. ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
  8. IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
  9. PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
  10. *************************************************************************
  11. -->
  12. <UsingTask TaskName="FindVsSDKInstallation" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" />
  13. <UsingTask TaskName="VSCTCompiler" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" />
  14. <UsingTask TaskName="CreateMenuPkgDef" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" />
  15. <!--
  16. Set the general properties for this installation of the SDK
  17. -->
  18. <PropertyGroup>
  19. <VsSDKVersion>10.0</VsSDKVersion>
  20. <VSSDKTargetPlatformVersion>10.0</VSSDKTargetPlatformVersion>
  21. <VSSDKTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VsSDKVersion)\VSSDK</VSSDKTargetsPath>
  22. <VSSDKTargetPlatformRegRoot>Software\Microsoft\VisualStudio\$(VSSDKTargetPlatformVersion)</VSSDKTargetPlatformRegRoot>
  23. <VSSDKTargetPlatformRegRootSuffix Condition="'$(VSSDKTargetPlatformRegRootSuffix)' == ''">Exp</VSSDKTargetPlatformRegRootSuffix>
  24. </PropertyGroup>
  25. <Target Name="FindSDKInstallation"
  26. Condition="'$(VsSDKInstall)'==''">
  27. <FindVsSDKInstallation SDKVersion="$(VsSDKVersion)">
  28. <Output TaskParameter="InstallationPath" PropertyName="VsSDKInstall" />
  29. <Output TaskParameter="IncludesPath" PropertyName="VsSDKIncludes" />
  30. <Output TaskParameter="ToolsPath" PropertyName="VsSDKToolsPath" />
  31. </FindVsSDKInstallation>
  32. </Target>
  33. <!--
  34. =======================================================================================================
  35. VSCT Compilation
  36. =======================================================================================================
  37. -->
  38. <PropertyGroup>
  39. <VSCTCompileDependsOn>$(VSCTCompileDependsOn);FindSDKInstallation</VSCTCompileDependsOn>
  40. <!--Make sure that the __CTC__ macro is defined. This macro is used in common headers
  41. like vsshids.h, so we need it for every VSCT compilation.-->
  42. <__internal_VSCTDefinitions>__CTC__;_CTC_GUIDS_;$(VSCTDefinitions)</__internal_VSCTDefinitions>
  43. <VsctVerboseOutput Condition="'$(VsctVerboseOutput)' == ''">false</VsctVerboseOutput>
  44. </PropertyGroup>
  45. <Target Name="VSCTCompile"
  46. DependsOnTargets="$(VSCTCompileDependsOn)"
  47. Condition="'$(BuildingProject)' != 'false' And '@(VSCTCompile)' != ''">
  48. <!--Create the list of include path to use for the VSCT compilation-->
  49. <ItemGroup>
  50. <!--First add the user provided folders-->
  51. <_InternalVSCTIncludePath Include="@(VSCTIncludePath)" Condition="'@(VSCTIncludePath)' != ''"/>
  52. <!--Now add the internal folders-->
  53. <_InternalVSCTIncludePath Include="$(VsSDKIncludes)" Condition="'$(VsSDKIncludes)' != ''"/>
  54. <_InternalVSCTIncludePath Include="$(VsSDKIncludes)\office10" Condition="'$(VsSDKIncludes)' != ''"/>
  55. </ItemGroup>
  56. <VSCTCompiler AdditionalIncludeDirectories="@(_InternalVSCTIncludePath)"
  57. IntermediateDirectory="$(IntermediateOutputPath)"
  58. Definitions="$(__internal_VSCTDefinitions)"
  59. NoLogo="true"
  60. OutputFile="%(VSCTCompile.FileName).cto"
  61. Source="%(VSCTCompile.Identity)"
  62. Verbose="$(VsctVerboseOutput)"
  63. SDKVersion="$(VsSDKVersion)">
  64. <Output TaskParameter="TemporaryFiles" ItemName="_TemporaryVsctCompilerFiles"/>
  65. </VSCTCompiler>
  66. <!--Record the VSCT compile CTO outputs for the Clean task.-->
  67. <ItemGroup>
  68. <FileWrites Include="$(IntermediateOutputPath)%(VSCTCompile.FileName).cto" Condition="Exists('$(IntermediateOutputPath)%(VSCTCompile.FileName).cto')"/>
  69. <FileWrites Include="@(_TemporaryVsctCompilerFiles)" />
  70. </ItemGroup>
  71. </Target>
  72. <!--
  73. =======================================================================================================
  74. Force AppId to refresh menu cache
  75. =======================================================================================================
  76. -->
  77. <!-- The goal of this target is to force a change in a Menu entry of a pkgdef file when a .vsct file is updated to force VS to pick up the new .cto -->
  78. <Target Name="CreateMenuPkgDef"
  79. Inputs="@(VSCTCompile)"
  80. Outputs="$(PkgdefFileWithMenuEntry)"
  81. DependsOnTargets="$(CreateMenuPkgDefDependsOn)"
  82. AfterTargets="VSCTCompile"
  83. BeforeTargets="PrepareForRun">
  84. <CreateMenuPkgDef PkgdefFile="$(PkgdefFileWithMenuEntry)" VsctFile="%(VSCTCompile.FullPath)" Condition="'$(PkgdefFileWithMenuEntry)'!=''"/>
  85. </Target>
  86. <!--
  87. ============================================================
  88. _VsixCleanRecordFileWrites
  89. Save the list of all files written to disk by the VSIX targets so that it can be used for "Clean" later.
  90. Files written in prior builds are not removed from Clean cache.
  91. ============================================================
  92. -->
  93. <Target
  94. Name="_VsixCleanRecordFileWrites"
  95. AfterTargets="IncrementalClean">
  96. <!-- Read the list of files deployed by prior builds from disk. -->
  97. <ReadLinesFromFile File="$(IntermediateOutputPath)$(VsixCleanFile)">
  98. <Output TaskParameter="Lines" ItemName="_VsixCleanPriorFileWrites"/>
  99. </ReadLinesFromFile>
  100. <!--
  101. Merge list of files from prior builds with the current build and then
  102. remove duplicates.
  103. -->
  104. <RemoveDuplicates Inputs="@(_VsixCleanPriorFileWrites);@(_VsixDeployCurrentFileWrites)">
  105. <Output TaskParameter="Filtered" ItemName="_VsixCleanUniqueFileWrites"/>
  106. </RemoveDuplicates>
  107. <!-- Make sure the directory exists. -->
  108. <MakeDir Directories="$(IntermediateOutputPath)"/>
  109. <!-- Write merged file list back to disk, replacing existing contents. -->
  110. <WriteLinesToFile
  111. File="$(IntermediateOutputPath)$(VsixCleanFile)"
  112. Lines="@(_VsixCleanUniqueFileWrites)"
  113. Overwrite="true" />
  114. </Target>
  115. <!--
  116. =======================================================================================================
  117. Clean Deployed Vsix Extension Files
  118. =======================================================================================================
  119. -->
  120. <PropertyGroup>
  121. <VsixCleanFile Condition="'$(VsixCleanFile)'==''">$(MSBuildProjectFile).VsixDeployedFileListAbsolute.txt</VsixCleanFile>
  122. <ShouldCleanDeployedVsixExtensionFiles Condition="'$(ShouldCleanDeployedVsixExtensionFiles)'==''">true</ShouldCleanDeployedVsixExtensionFiles>
  123. </PropertyGroup>
  124. <Target Name="CleanDeployedVsixExtensionFiles"
  125. BeforeTargets="AfterClean"
  126. Condition="$(ShouldCleanDeployedVsixExtensionFiles)">
  127. <!-- Read the list of files deployed by prior builds from disk. -->
  128. <ReadLinesFromFile File="$(IntermediateOutputPath)$(VsixCleanFile)">
  129. <Output TaskParameter="Lines" ItemName="_VsixCleanPriorFileWrites"/>
  130. </ReadLinesFromFile>
  131. <!-- Remove duplicates. -->
  132. <RemoveDuplicates Inputs="@(_VsixCleanPriorFileWrites)">
  133. <Output TaskParameter="Filtered" ItemName="_VsixUniqueCleanPriorFileWrites"/>
  134. </RemoveDuplicates>
  135. <Delete Files="@(_VsixUniqueCleanPriorFileWrites)" TreatErrorsAsWarnings="true">
  136. <Output TaskParameter="DeletedFiles" ItemName="_VsixCleanFilesDeleted"/>
  137. </Delete>
  138. <!-- Create a list of everything that wasn't deleted for some reason. -->
  139. <ItemGroup>
  140. <_VsixCleanRemainingFileWritesAfterIncrementalClean Include="@(_VsixUniqueCleanPriorFileWrites)" Exclude="@(_VsixCleanFilesDeleted)"/>
  141. </ItemGroup>
  142. <!-- Write new list of current files back to disk, replacing the existing list.-->
  143. <WriteLinesToFile
  144. File="$(IntermediateOutputPath)$(VsixCleanFile)"
  145. Lines="@(_VsixCleanRemainingFileWritesAfterIncrementalClean)"
  146. Condition="'@(_VsixCleanPriorFileWrites)'!='@(_VsixCleanRemainingFileWritesAfterIncrementalClean)'"
  147. Overwrite="true"/>
  148. </Target>
  149. </Project>