|
| 1 | + |
| 2 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 3 | +<!-- |
| 4 | +************************************************************************* |
| 5 | +Copyright (c) Microsoft Corporation. All rights reserved. |
| 6 | +This code is licensed under the Visual Studio SDK license terms. |
| 7 | +THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF |
| 8 | +ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY |
| 9 | +IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR |
| 10 | +PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. |
| 11 | +************************************************************************* |
| 12 | +--> |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + <UsingTask TaskName="FindVsSDKInstallation" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" /> |
| 72 | + <UsingTask TaskName="VSCTCompiler" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" /> |
| 73 | + <UsingTask TaskName="CreateMenuPkgDef" AssemblyFile="Microsoft.VsSDK.Build.Tasks.dll" /> |
| 74 | + |
| 75 | + <!-- |
| 76 | + Set the general properties for this installation of the SDK |
| 77 | + --> |
| 78 | + <PropertyGroup> |
| 79 | + <VsSDKVersion>14.0</VsSDKVersion> |
| 80 | + <VSSDKTargetPlatformVersion>14.0</VSSDKTargetPlatformVersion> |
| 81 | + <VSSDKTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VsSDKVersion)\VSSDK</VSSDKTargetsPath> |
| 82 | + <VSSDKTargetPlatformRegRoot>Software\Microsoft\VisualStudio\$(VSSDKTargetPlatformVersion)</VSSDKTargetPlatformRegRoot> |
| 83 | + <VSSDKTargetPlatformRegRootSuffix Condition="'$(VSSDKTargetPlatformRegRootSuffix)' == ''">Exp</VSSDKTargetPlatformRegRootSuffix> |
| 84 | + </PropertyGroup> |
| 85 | + |
| 86 | + <Target Name="FindSDKInstallation" |
| 87 | + Condition="'$(VsSDKInstall)'==''"> |
| 88 | + <FindVsSDKInstallation SDKVersion="$(VsSDKVersion)"> |
| 89 | + <Output TaskParameter="InstallationPath" PropertyName="VsSDKInstall" /> |
| 90 | + <Output TaskParameter="IncludesPath" PropertyName="VsSDKIncludes" /> |
| 91 | + <Output TaskParameter="ToolsPath" PropertyName="VsSDKToolsPath" /> |
| 92 | + </FindVsSDKInstallation> |
| 93 | + </Target> |
| 94 | + |
| 95 | + <!-- |
| 96 | + ======================================================================================================= |
| 97 | + VSCT Compilation |
| 98 | + ======================================================================================================= |
| 99 | + --> |
| 100 | + <PropertyGroup> |
| 101 | + <VSCTCompileDependsOn>$(VSCTCompileDependsOn);FindSDKInstallation</VSCTCompileDependsOn> |
| 102 | + <!--Make sure that the __CTC__ macro is defined. This macro is used in common headers |
| 103 | + like vsshids.h, so we need it for every VSCT compilation.--> |
| 104 | + <__internal_VSCTDefinitions>__CTC__;_CTC_GUIDS_;$(VSCTDefinitions)</__internal_VSCTDefinitions> |
| 105 | + <VsctVerboseOutput Condition="'$(VsctVerboseOutput)' == ''">false</VsctVerboseOutput> |
| 106 | + </PropertyGroup> |
| 107 | + |
| 108 | + <Target Name="VSCTCompile" |
| 109 | + DependsOnTargets="$(VSCTCompileDependsOn)" |
| 110 | + Condition="'$(BuildingProject)' != 'false' And '@(VSCTCompile)' != ''"> |
| 111 | + |
| 112 | + <!--Create the list of include path to use for the VSCT compilation--> |
| 113 | + <ItemGroup> |
| 114 | + <!--First add the user provided folders--> |
| 115 | + <_InternalVSCTIncludePath Include="@(VSCTIncludePath)" Condition="'@(VSCTIncludePath)' != ''"/> |
| 116 | + <!--Now add the internal folders--> |
| 117 | + <_InternalVSCTIncludePath Include="$(VsSDKIncludes)" Condition="'$(VsSDKIncludes)' != ''"/> |
| 118 | + <_InternalVSCTIncludePath Include="$(VsSDKIncludes)\office10" Condition="'$(VsSDKIncludes)' != ''"/> |
| 119 | + </ItemGroup> |
| 120 | + |
| 121 | + <VSCTCompiler AdditionalIncludeDirectories="@(_InternalVSCTIncludePath)" |
| 122 | + IntermediateDirectory="$(IntermediateOutputPath)" |
| 123 | + Definitions="$(__internal_VSCTDefinitions)" |
| 124 | + NoLogo="true" |
| 125 | + OutputFile="%(VSCTCompile.FileName).cto" |
| 126 | + Source="%(VSCTCompile.Identity)" |
| 127 | + Verbose="$(VsctVerboseOutput)" |
| 128 | + SDKVersion="$(VsSDKVersion)"> |
| 129 | + <Output TaskParameter="TemporaryFiles" ItemName="_TemporaryVsctCompilerFiles"/> |
| 130 | + </VSCTCompiler> |
| 131 | + |
| 132 | + <!--Record the VSCT compile CTO outputs for the Clean task.--> |
| 133 | + <ItemGroup> |
| 134 | + <FileWrites Include="$(IntermediateOutputPath)%(VSCTCompile.FileName).cto" Condition="Exists('$(IntermediateOutputPath)%(VSCTCompile.FileName).cto')"/> |
| 135 | + <FileWrites Include="@(_TemporaryVsctCompilerFiles)" /> |
| 136 | + </ItemGroup> |
| 137 | + </Target> |
| 138 | + |
| 139 | + <!-- |
| 140 | + ======================================================================================================= |
| 141 | + Force AppId to refresh menu cache |
| 142 | + ======================================================================================================= |
| 143 | + --> |
| 144 | + <!-- 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 --> |
| 145 | + <Target Name="CreateMenuPkgDef" |
| 146 | + Inputs="@(VSCTCompile)" |
| 147 | + Outputs="$(PkgdefFileWithMenuEntry)" |
| 148 | + DependsOnTargets="$(CreateMenuPkgDefDependsOn)" |
| 149 | + AfterTargets="VSCTCompile" |
| 150 | + BeforeTargets="PrepareForRun"> |
| 151 | + |
| 152 | + <CreateMenuPkgDef PkgdefFile="$(PkgdefFileWithMenuEntry)" VsctFile="%(VSCTCompile.FullPath)" Condition="'$(PkgdefFileWithMenuEntry)'!=''"/> |
| 153 | + </Target> |
| 154 | + |
| 155 | + |
| 156 | + <!-- |
| 157 | + ============================================================ |
| 158 | + _VsixCleanRecordFileWrites |
| 159 | +
|
| 160 | + Save the list of all files written to disk by the VSIX targets so that it can be used for "Clean" later. |
| 161 | +
|
| 162 | + Files written in prior builds are not removed from Clean cache. |
| 163 | + ============================================================ |
| 164 | + --> |
| 165 | + <Target |
| 166 | + Name="_VsixCleanRecordFileWrites" |
| 167 | + AfterTargets="IncrementalClean"> |
| 168 | + |
| 169 | + <!-- Read the list of files deployed by prior builds from disk. --> |
| 170 | + <ReadLinesFromFile File="$(IntermediateOutputPath)$(VsixCleanFile)"> |
| 171 | + <Output TaskParameter="Lines" ItemName="_VsixCleanPriorFileWrites"/> |
| 172 | + </ReadLinesFromFile> |
| 173 | + |
| 174 | + <!-- |
| 175 | + Merge list of files from prior builds with the current build and then |
| 176 | + remove duplicates. |
| 177 | + --> |
| 178 | + <RemoveDuplicates Inputs="@(_VsixCleanPriorFileWrites);@(_VsixDeployCurrentFileWrites)"> |
| 179 | + <Output TaskParameter="Filtered" ItemName="_VsixCleanUniqueFileWrites"/> |
| 180 | + </RemoveDuplicates> |
| 181 | + |
| 182 | + <!-- Make sure the directory exists. --> |
| 183 | + <MakeDir Directories="$(IntermediateOutputPath)"/> |
| 184 | + |
| 185 | + <!-- Write merged file list back to disk, replacing existing contents. --> |
| 186 | + <WriteLinesToFile |
| 187 | + File="$(IntermediateOutputPath)$(VsixCleanFile)" |
| 188 | + Lines="@(_VsixCleanUniqueFileWrites)" |
| 189 | + Overwrite="true" /> |
| 190 | + |
| 191 | + </Target> |
| 192 | + |
| 193 | + <!-- |
| 194 | + ======================================================================================================= |
| 195 | + Clean Deployed Vsix Extension Files |
| 196 | + ======================================================================================================= |
| 197 | + --> |
| 198 | + <PropertyGroup> |
| 199 | + <VsixCleanFile Condition="'$(VsixCleanFile)'==''">$(MSBuildProjectFile).VsixDeployedFileListAbsolute.txt</VsixCleanFile> |
| 200 | + <ShouldCleanDeployedVsixExtensionFiles Condition="'$(ShouldCleanDeployedVsixExtensionFiles)'==''">true</ShouldCleanDeployedVsixExtensionFiles> |
| 201 | + </PropertyGroup> |
| 202 | + <Target Name="CleanDeployedVsixExtensionFiles" |
| 203 | + BeforeTargets="AfterClean" |
| 204 | + Condition="$(ShouldCleanDeployedVsixExtensionFiles)"> |
| 205 | + |
| 206 | + <!-- Read the list of files deployed by prior builds from disk. --> |
| 207 | + <ReadLinesFromFile File="$(IntermediateOutputPath)$(VsixCleanFile)"> |
| 208 | + <Output TaskParameter="Lines" ItemName="_VsixCleanPriorFileWrites"/> |
| 209 | + </ReadLinesFromFile> |
| 210 | + |
| 211 | + <!-- Remove duplicates. --> |
| 212 | + <RemoveDuplicates Inputs="@(_VsixCleanPriorFileWrites)"> |
| 213 | + <Output TaskParameter="Filtered" ItemName="_VsixUniqueCleanPriorFileWrites"/> |
| 214 | + </RemoveDuplicates> |
| 215 | + |
| 216 | + <Delete Files="@(_VsixUniqueCleanPriorFileWrites)" TreatErrorsAsWarnings="true"> |
| 217 | + <Output TaskParameter="DeletedFiles" ItemName="_VsixCleanFilesDeleted"/> |
| 218 | + </Delete> |
| 219 | + |
| 220 | + <!-- Create a list of everything that wasn't deleted for some reason. --> |
| 221 | + <ItemGroup> |
| 222 | + <_VsixCleanRemainingFileWritesAfterIncrementalClean Include="@(_VsixUniqueCleanPriorFileWrites)" Exclude="@(_VsixCleanFilesDeleted)"/> |
| 223 | + </ItemGroup> |
| 224 | + |
| 225 | + <!-- Write new list of current files back to disk, replacing the existing list.--> |
| 226 | + <WriteLinesToFile |
| 227 | + File="$(IntermediateOutputPath)$(VsixCleanFile)" |
| 228 | + Lines="@(_VsixCleanRemainingFileWritesAfterIncrementalClean)" |
| 229 | + Condition="'@(_VsixCleanPriorFileWrites)'!='@(_VsixCleanRemainingFileWritesAfterIncrementalClean)'" |
| 230 | + Overwrite="true"/> |
| 231 | + |
| 232 | + </Target> |
| 233 | + |
| 234 | +</Project> |
0 commit comments