Imports.targets 23.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- Copyright (c)  Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information. -->

  <!-- If the project hasn't configured a ruleset, set a default ruleset. -->
  <Choose>
    <When Condition="'$(RoslynProjectType)' == 'Dll'">
      <PropertyGroup>
        <_CopyReferences>false</_CopyReferences>
        <_CopyProjectReferences>false</_CopyProjectReferences>
        <OutDir>$(OutDir)Dlls\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'ExeDesktop'">
      <PropertyGroup>
        <OutDir>$(OutDir)Exes\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'ExeCoreClr'">
      <PropertyGroup>
        <_CopyReferences>false</_CopyReferences>
        <OutDir>$(OutDir)Exes\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'ToolDesktop'">
      <PropertyGroup>
        <OutDir>$(OutDir)Tools\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'UnitTest'">
      <PropertyGroup>
        <OutDir>$(OutDir)UnitTests\Current\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'UnitTestNext'">
      <PropertyGroup>
        <_CopyReferences>false</_CopyReferences>
        <OutDir>$(OutDir)UnitTests\Next\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'CompilerGeneratorTool'">
      <PropertyGroup>
        <_CopyReferences>false</_CopyReferences>
        <OutDir>$(OutDir)Exes\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'DeploymentCompilerGeneratorTools'">
      <PropertyGroup>
        <OutDir>$(OutDir)CompilerGeneratorTools\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'Deployment'">
      <PropertyGroup>
        <OutDir>$(OutDir)Deployment\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'Vsix'">
      <PropertyGroup>
        <_CopyReferences>false</_CopyReferences>
        <OutDir>$(OutDir)Vsix\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'Ignore'">
      <!-- Thinking through these -->
      <PropertyGroup>
        <_CopyReferences>false</_CopyReferences>
        <_CopyProjectReferences>false</_CopyProjectReferences>
        <OutDir>$(OutDir)Ignore\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'Dependency'">
      <!-- Thinking through these -->
      <PropertyGroup>
        <OutDir>$(OutDir)Ignore\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == 'Custom'">
      <!-- Do nothing -->
    </When>
    <When Condition="'$(RoslynProjectType)' == '' and '$(OutputType)' == 'Library'">
      <PropertyGroup>
        <_CopyReferences>false</_CopyReferences>
        <_CopyProjectReferences>false</_CopyProjectReferences>
        <OutDir>$(OutDir)Dlls\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == '' and '$(OutputType)' == 'Exe'">
      <PropertyGroup>
        <OutDir>$(OutDir)Exes\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
    <When Condition="'$(RoslynProjectType)' == '' and '$(OutputType)' == 'WinExe'">
      <PropertyGroup>
        <OutDir>$(OutDir)Exes\$(MSBuildProjectName)\</OutDir>
      </PropertyGroup>
    </When>
  </Choose>

  <ItemDefinitionGroup Condition="'$(_CopyReferences)' == 'false'">
    <Reference>
      <Private>False</Private>
    </Reference>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="'$(_CopyProjectReferences)' == 'false'">
    <ProjectReference>
      <Private>False</Private>
    </ProjectReference>
  </ItemDefinitionGroup>

  <!-- This file is imported by all projects at the end of the project files -->
  <!-- Update common properties -->
  <PropertyGroup>
    <OutputPath>$(OutDir)</OutputPath>
    <DocumentationFile Condition="'$(DocumentationFile)' == '' AND '$(NoDocumentationFile)' != 'true' AND '$(Nonshipping)' != 'true' AND '$(ProjectLanguage)' == 'VB' AND '$(AssemblyName)' != ''">$(AssemblyName).xml</DocumentationFile>
    <DocumentationFile Condition="'$(DocumentationFile)' == '' AND '$(NoDocumentationFile)' != 'true' AND '$(Nonshipping)' != 'true' AND '$(ProjectLanguage)' == 'CSharp' AND '$(AssemblyName)' != ''">$(BaseIntermediateOutputPath)$(AssemblyName).xml</DocumentationFile>
    <RoslynPublicKey>0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9</RoslynPublicKey>
    <RoslynInternalKey>002400000480000094000000060200000024000052534131000400000100010055e0217eb635f69281051f9a823e0c7edd90f28063eb6c7a742a19b4f6139778ee0af438f47aed3b6e9f99838aa8dba689c7a71ddb860c96d923830b57bbd5cd6119406ddb9b002cf1c723bf272d6acbb7129e9d6dd5a5309c94e0ff4b2c884d45a55f475cd7dba59198086f61f5a8c8b5e601c0edbf269733f6f578fc8579c2</RoslynInternalKey>

    <!-- While UseCommonOutputDirectory will prevent NuGet implementations from being copied, 
         we still need to turn off CopyNuGetImplementations to prevent the build task from complaining about a 
         lack of a runtime section in our project.json. -->
    <CopyNuGetImplementations Condition="'$(UseCommonOutputDirectory)' == 'true'">false</CopyNuGetImplementations>
  </PropertyGroup>

  <!-- If the project hasn't configured a ruleset, set a default ruleset. -->
  <Choose>
    <When Condition="'$(CodeAnalysisRuleSet)' == ''">
      <Choose>
        <!-- We have different default rulesets for Build versus Running Code Analysis. -->
        <When Condition="'$(RunCodeAnalysis)'=='true' OR '$(RunCodeAnalysisOnce)'=='true'">
          <PropertyGroup>
            <DefaultRulesetSuffix>_RunCodeAnalysisRules</DefaultRulesetSuffix>
          </PropertyGroup>
        </When>
        <Otherwise>
          <PropertyGroup>
            <DefaultRulesetSuffix>_BuildRules</DefaultRulesetSuffix>
          </PropertyGroup>
        </Otherwise>
      </Choose>

      <PropertyGroup>
J
Jared Parsons 已提交
143 144 145
        <CodeAnalysisRuleSet Condition="'$(CodeAnalysisRuleSet)' == '' AND '$(NonShipping)' == 'true'">$(MSBuildThisFileDirectory)..\Rulesets\NonShippingProject$(DefaultRulesetSuffix).ruleset</CodeAnalysisRuleSet>
        <CodeAnalysisRuleSet Condition="'$(CodeAnalysisRuleSet)' == '' AND '$(AnalyzerProject)' == 'true'">$(MSBuildThisFileDirectory)..\Rulesets\AnalyzerProject$(DefaultRulesetSuffix).ruleset</CodeAnalysisRuleSet>
        <CodeAnalysisRuleSet Condition="'$(CodeAnalysisRuleSet)' == ''">$(MSBuildThisFileDirectory)..\Rulesets\Roslyn$(DefaultRulesetSuffix).ruleset</CodeAnalysisRuleSet>
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
      </PropertyGroup>
    </When>
  </Choose>

  <!-- Enable IOperation feature for IOperation based analyzers. -->
  <Choose>
    <When Condition="$(Features) == ''">
      <PropertyGroup>
        <Features>IOperation</Features>
      </PropertyGroup>
    </When>
    <Otherwise>
      <PropertyGroup>
        <Features>IOperation,$(Features)</Features>
  </PropertyGroup>
    </Otherwise>
  </Choose>

  <!-- Settings for strong name signing -->
  <Choose>
    <When Condition="'$(SignAssembly)' == 'true'">
      <Choose>
        <!-- Shipping binaries are always public signed.  In the case of an official build $(OfficialBuild) the 
             binaries will be real signed as a post processing step. -->
        <When Condition="'$(NonShipping)' != 'true'">
          <PropertyGroup>
J
Jared Parsons 已提交
172
            <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\Strong Name Keys\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
173 174 175 176 177 178 179 180 181
            <PublicKey>$(RoslynPublicKey)</PublicKey>
            <PublicKeyToken>31BF3856AD364E35</PublicKeyToken>
            <PublicSign>true</PublicSign>
          </PropertyGroup>
        </When>

        <!-- Non-shipping binaries are simply signed with the Roslyn internal key. -->
        <Otherwise>
          <PropertyGroup>
J
Jared Parsons 已提交
182
            <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\Strong Name Keys\RoslynInternalKey.Private.snk</AssemblyOriginatorKeyFile>
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
            <DelaySign>false</DelaySign>
            <PublicKey>$(RoslynInternalKey)</PublicKey>
            <PublicKeyToken>fc793a00266884fb</PublicKeyToken>
          </PropertyGroup>
        </Otherwise>
      </Choose>
    </When>
  </Choose>

  <!-- ====================================================================================

         Generation of binding redirects.

       ==================================================================================== -->
  <ItemGroup Condition="'$(GenerateMSBuildBindingRedirects)' == 'true'">
      <SuggestedBindingRedirects Include="Microsoft.Build, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <MaxVersion>$(VisualStudioReferenceAssemblyVersion)</MaxVersion>
      </SuggestedBindingRedirects>
      <SuggestedBindingRedirects Include="Microsoft.Build.Engine, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <MaxVersion>$(VisualStudioReferenceAssemblyVersion)</MaxVersion>
      </SuggestedBindingRedirects>
      <SuggestedBindingRedirects Include="Microsoft.Build.Framework, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <MaxVersion>$(VisualStudioReferenceAssemblyVersion)</MaxVersion>
      </SuggestedBindingRedirects>
      <SuggestedBindingRedirects Include="Microsoft.Build.Tasks.$(MSBuildAssemblyNameFragment), Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <MaxVersion>$(VisualStudioReferenceAssemblyVersion)</MaxVersion>
      </SuggestedBindingRedirects>
      <SuggestedBindingRedirects Include="Microsoft.Build.Utilities.Core, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <MaxVersion>$(VisualStudioReferenceAssemblyVersion)</MaxVersion>
      </SuggestedBindingRedirects>
  </ItemGroup>
  <PropertyGroup>
    <ForceGenerationOfBindingRedirects Condition="'$(GenerateMSBuildBindingRedirects)' == 'true'">true</ForceGenerationOfBindingRedirects>
    <AutoGenerateBindingRedirects Condition="'$(ForceGenerationOfBindingRedirects)' == 'true'">true</AutoGenerateBindingRedirects>
  </PropertyGroup>

  <Target Name="ForceGenerationOfBindingRedirects"
          AfterTargets="ResolveAssemblyReferences"
          BeforeTargets="GenerateBindingRedirects"
          Condition="'$(ForceGenerationOfBindingRedirects)' == 'true'">

    <PropertyGroup>
      <!-- Needs to be set in a target because it has to be set after the initial evaluation in the common targets -->
      <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    </PropertyGroup>
  </Target>

  <Choose>
    <When Condition="'$(ProjectLanguage)' == 'VB'">
      <PropertyGroup>
        <MSBuildTargetsLanguageName>VisualBasic</MSBuildTargetsLanguageName>
      </PropertyGroup>
    </When>
    <When Condition="'$(ProjectLanguage)' == 'CSharp'">
      <PropertyGroup>
        <MSBuildTargetsLanguageName>CSharp</MSBuildTargetsLanguageName>
      </PropertyGroup>
    </When>
  </Choose>

  <Choose>
    <When Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable'">
      <PropertyGroup>
        <MSBuildTargetsFilePath>$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.$(MSBuildTargetsLanguageName).targets</MSBuildTargetsFilePath>
      </PropertyGroup>
    </When>
    <Otherwise>
      <PropertyGroup>
        <MSBuildTargetsFilePath>$(MSBuildToolsPath)\Microsoft.$(MSBuildTargetsLanguageName).targets</MSBuildTargetsFilePath>
      </PropertyGroup>
    </Otherwise>
  </Choose>

  <Import Project="$(MSBuildTargetsFilePath)" />

  <!-- On Mono on *nix the NuGet targets aren't imported by default, so we do that here -->
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\NuGet\Microsoft.NuGet.targets"
          Condition="'$(OS)' != 'Windows_NT'" />

  <Choose>
    <When Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable' AND
                     '$(TargetFrameworkVersion)' == 'v5.0'">
      <!-- Treat portable exes as CoreClr-targeting-exes -->
      <PropertyGroup Condition="'$(OutputType)' == 'Exe'">
        <NuGetTargetMoniker>.NETCoreApp,Version=v1.0</NuGetTargetMoniker>
        <BaseNuGetRuntimeIdentifier Condition="'$(OS)' == 'Windows_NT'">win7</BaseNuGetRuntimeIdentifier>
      </PropertyGroup>

      <!-- Upgrade portable projects to .NETStandard 1.3 -->
      <PropertyGroup Condition="'$(OutputType)' == 'Library'">
        <NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
      </PropertyGroup>
    </When>
  </Choose>

  <!-- It looks like MSBuild has a bug on *nix where they aggressively
       directory separators from '\' to '/', even when the '\'
       is being used as an escape character in a define constant in VB.
       This change works around the bug by removing all quotes from
       define constants after Microsoft.VisualBasic.CurrentVersion adds
       them in our build. This should be OK since none of our constants
       should require quoting. See https://github.com/Microsoft/msbuild/issues/137 -->
  <PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
    <FinalDefineConstants>$(FinalDefineConstants.Replace('"', ''))</FinalDefineConstants>
  </PropertyGroup>

  <!-- For our projects that specify multiple targets in the project.json to work around https://github.com/dotnet/roslyn/issues/12458,
       we need to also silence a NuGet generated warning -->
  <Target Name="EmitMSBuildWarning"></Target>

  <!-- ====================================================================================

         Support for a IncludeInVSIXLocalOnly Content metadata

       ==================================================================================== -->

  <PropertyGroup>
    <GetVsixSourceItemsDependsOn>$(GetVsixSourceItemsDependsOn);IncludeVsixLocalOnlyItems</GetVsixSourceItemsDependsOn>
  </PropertyGroup>

  <Target Name="IncludeVsixLocalOnlyItems">
    <!-- This is shamelessly ripped from Microsoft.VsSDK.targets -->
    <ItemGroup>
      <VSIXSourceItemLocalOnly Include="@(Content)" Condition="'%(Content.IncludeInVSIXLocalOnly)'=='true' AND '%(Content.VSIXSubPath)'==''">
        <!-- Sets VSIXSubPath for content items that are nonlinked files -->
        <VSIXSubPath Condition="'%(Content.Link)'==''">%(Content.RelativeDir)</VSIXSubPath>
        <!-- Sets VSIXSubPath for content items that are linked files -->
        <VSIXSubPath Condition="'%(Content.Link)'!=''">$([System.IO.Path]::GetDirectoryName(%(Content.Link)))</VSIXSubPath>
      </VSIXSourceItemLocalOnly>

      <VSIXSourceItemLocalOnly Include="@(Content)" Condition="'%(Content.IncludeInVSIXLocalOnly)'=='true' AND '%(Content.VSIXSubPath)'!=''" />
    </ItemGroup>
  </Target>

  <!-- ====================================================================================

         Include some of our NuGet-consumed assets into VSIX projects

         This exists for two reasons:

         1) In some cases, we need to include the contents of a NuGet package that is otherwise
            contained within the SuppressFromVsix list, because we're actually the component
            inside Visual Studio that ships that component
         
         2) The SDK targets don't currently look at the ReferenceCopyLocalPaths produced
            by the NuGet build task.

       ==================================================================================== -->

  <PropertyGroup>
    <GetVsixSourceItemsDependsOn>$(GetVsixSourceItemsDependsOn);IncludeNuGetResolvedAssets</GetVsixSourceItemsDependsOn>
  </PropertyGroup>

  <Target Name="IncludeNuGetResolvedAssets" DependsOnTargets="ResolveNuGetPackageAssets" Condition="'@(NuGetPackageToIncludeInVsix)' != ''">
    <ItemGroup>
      <_ReferenceCopyLocalPathsWithPotentialInclusions Include="@(ReferenceCopyLocalPaths)">
        <NuGetPackageToIncludeInVsix>%(NuGetPackageToIncludeInVsix.Identity)</NuGetPackageToIncludeInVsix>
      </_ReferenceCopyLocalPathsWithPotentialInclusions>

      <VSIXCopyLocalReferenceSourceItem Include="@(_ReferenceCopyLocalPathsWithPotentialInclusions)"
        Condition="'%(_ReferenceCopyLocalPathsWithPotentialInclusions.NuGetPackageId)' == '%(_ReferenceCopyLocalPathsWithPotentialInclusions.NuGetPackageToIncludeInVsix)' and
                   '%(_ReferenceCopyLocalPathsWithPotentialInclusions.Extension)' != '.pdb'">
        <ForceIncludeInVsix>true</ForceIncludeInVsix>
        <Private>true</Private>
      </VSIXCopyLocalReferenceSourceItem>
    </ItemGroup>
  </Target>

  <ItemDefinitionGroup>
    <NuGetPackageToIncludeInVsix>
      <Visible>false</Visible>
    </NuGetPackageToIncludeInVsix>
  </ItemDefinitionGroup>

  <!-- This is a copy of the Microsoft.VisualStudio.SDK.EmbedInteropTypes NuGet package, but only the list of
       assemblies that we need. The package includes things like EnvDTE which are reasonable for consumers, but
       strange since we actually _implement_ DTE and use it as an exchange type with generics in a few places. -->
  <Target Name="LinkVSSDKEmbeddableAssemblies" DependsOnTargets="ResolveReferences" AfterTargets="ResolveReferences">
    <ItemGroup>
      <ReferencePath Condition="
              '%(FileName)' == 'Microsoft.VisualStudio.Shell.Embeddable'
           or '%(FileName)' == 'Microsoft.VisualStudio.Shell.Interop.12.0'
           or '%(FileName)' == 'Microsoft.VisualStudio.Shell.Interop.12.1.DesignTime'
           or '%(FileName)' == 'Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime'
           or '%(FileName)' == 'Microsoft.VisualStudio.Shell.Interop.15.0.DesignTime'
           or '%(Filename)' == 'Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime'
           or '%(FileName)' == 'Microsoft.VisualStudio.TextManager.Interop.12.1.DesignTime'
           or '%(FileName)' == 'Microsoft.Internal.VisualStudio.Shell.Interop.14.0.DesignTime'
           or '%(FileName)' == 'Microsoft.VisualStudio.ProjectSystem.Interop'
           or '%(FileName)' == 'stdole'
           or '%(FileName)' == 'Microsoft.VisualStudio.CommandBars'
              ">
        <EmbedInteropTypes>true</EmbedInteropTypes>
      </ReferencePath>
    </ItemGroup>
  </Target>

  <!-- ====================================================================================

         Generation of AssemblyVersion attributes from the BuildVersion property

       ==================================================================================== -->

  <Import Project="GenerateAssemblyInfo.targets" Condition="'$(ProjectLanguage)' == 'CSharp' OR '$(ProjectLanguage)' == 'VB'" />

  <!-- ====================================================================================

         Generation of InternalsVisibleTo attributes from the project

       ==================================================================================== -->

  <Import Project="GenerateInternalsVisibleTo.targets" />

  <!-- ====================================================================================

         Generation of syntax models, syntax model tests, and bound trees from xml files

       ==================================================================================== -->

  <Import Project="GenerateCompilerInternals.targets" />

  <!-- ====================================================================================

         VSSDK

       ==================================================================================== -->

J
Jared Parsons 已提交
410
  <Import Project="$(NuGetPackageRoot)\Microsoft.VSSDK.BuildTools\$(VisualStudioBuildToolsVersion)\build\Microsoft.VsSDK.BuildTools.targets" Condition="'$(ImportVSSDKTargets)' == 'true'" />
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
  <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(ImportVSSDKTargets)' == 'true'" />

  <!-- ====================================================================================

         Support for in-place modification of the compiled binary.
         Since there may be more than one post compile modification, we must take care not
         to break incremental builds. A timestemp file is written out when all modification
         targets have completed.
         Note that the targets participating in post compile modification must list the
         sentinel file as one of their outputs, but they should not modify it.

       ==================================================================================== -->

  <PropertyGroup>
    <PostCompileBinaryModificationSentinelFile>$(IntermediateOutputPath)$(TargetFileName).pcbm</PostCompileBinaryModificationSentinelFile>
  </PropertyGroup>

  <Target Name="PostCompileBinaryModification"
          AfterTargets="CoreCompile"
          DependsOnTargets="ApplyOptimizations"
          Inputs="@(IntermediateAssembly)"
          Outputs="@(IntermediateAssembly);$(PostCompileBinaryModificationSentinelFile)">

    <!-- Write out a sentinel timestamp file to prevent unnecessary work in incremental builds. -->
    <Touch AlwaysCreate="true" Files="$(PostCompileBinaryModificationSentinelFile)" />

    <ItemGroup>
      <FileWrites Include="$(PostCompileBinaryModificationSentinelFile)" />
    </ItemGroup>
  </Target>

  <!-- ====================================================================================

         Support for rolling optimization data into assemblies.

       ==================================================================================== -->

  <PropertyGroup>
    <OptimizationDataFolderPath>$(NuGetPackageRoot)\RoslynDependencies.OptimizationData\2.0.0-beta5-60913-03\content\OptimizationData</OptimizationDataFolderPath>
    <OptimizationDataFile>$([System.IO.Path]::GetFullPath('$(OptimizationDataFolderPath)\$(TargetName).pgo'))</OptimizationDataFile>
  </PropertyGroup>

  <!-- The path to IBCMerge.exe must be specified at build time via $(IbcMergePath).  Typically this is passed as a build definition variable -->
  <Target Name="ApplyOptimizations"
          Condition="'$(OfficialBuild)' == 'true' AND '$(NonShipping)' != 'true' AND '$(SkipApplyOptimizations)' != 'true' AND Exists('$(OptimizationDataFile)') AND Exists('$(IbcMergePath)')"
          Inputs="@(IntermediateAssembly)"
          Outputs="@(IntermediateAssembly);$(PostCompileBinaryModificationSentinelFile)">

      <Message Text="Adding optimization data to @(IntermediateAssembly)" />
      <Exec Command="&quot;$(IbcMergePath)&quot; -q -f -partialNGEN -minify -mo &quot;@(IntermediateAssembly)&quot; -incremental &quot;$(OptimizationDataFile)&quot;"
            ConsoleToMSBuild="true">
        <Output TaskParameter="ConsoleOutput" PropertyName="IbcMergeOutput" />
      </Exec>
      <Message Text="$(IbcMergeOutput)" />

  </Target>

  <!-- ====================================================================================

         Support for signing VSIXes

       ==================================================================================== -->

    

  <PropertyGroup>
	<ProducingSignedVsix Condition="'$(ShouldSignBuild)' == 'true' AND '$(NonShipping)' != 'true' AND '$(CreateVsixContainer)' == 'true'">true</ProducingSignedVsix>
  </PropertyGroup>
</Project>