summaryrefslogtreecommitdiff
path: root/.dotnet/sdk/3.1.100/Sdks/Microsoft.NET.Sdk/targets/GenerateDeps/GenerateDeps.proj
blob: 6acbdbfe06aa8546d8c59dd437acd1275a18b93d (plain)
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
<Project DefaultTargets="BuildDepsJson">
  <!--
***********************************************************************************************
GenerateDeps.proj

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved. 
***********************************************************************************************
-->
  
  <!--
    This project is built by the .NET CLI in order to create .deps.json files for .NET CLI tools.
    Properties to be passed in by the .NET CLI:
      - ProjectAssetsFile: Full path to the project.assets.json file for the tool under the NuGet .tools folder
      - ToolName: The simple name of the tool DLL, for example, "dotnet-mytool"
      - AdditionalImport: The full path to the .props file from the platform package which will be imported, which
        should include the PackageConflictPlatformManifests file.      
        This is a workaround until NuGet can generate .props and .targets files for imports from packages referenced
        by tools, which is tracked by https://github.com/NuGet/Home/issues/5037.
  -->
  
  <PropertyGroup>
    <ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
    <ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
  </PropertyGroup>

  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <Import Project="$(AdditionalImport)"
          Condition=" '$(AdditionalImport)' != '' And Exists($(AdditionalImport))" />
  
  <PropertyGroup>
    <ToolFolder>$([System.IO.Path]::GetDirectoryName($(ProjectAssetsFile)))</ToolFolder>
    <ProjectDepsFilePath Condition="'$(ProjectDepsFilePath)' == ''">$(ToolFolder)\$(ToolName).deps.json</ProjectDepsFilePath>
    <OutputType>Exe</OutputType>
    <IncludeMainProjectInDepsFile>false</IncludeMainProjectInDepsFile>

    <!-- This project must not write to intermediate directory as it is inside the SDK directory and not in a user path. -->
    <DisablePackageAssetsCache>true</DisablePackageAssetsCache>
    <DisableRarCache>true</DisableRarCache>

    <!-- The tool asets file is restored as a separate graph and doesn't get an implicit reference to Microsoft.NETCore.App.  So
         the version of that package will be determined by the version the tool package references.  However, when building
         GenerateDeps.proj, the CLI sets the TargetFramework to match the target it finds in the assets file, which is
         based on what the project with the DotNetCliToolReference was targeting, not what the tool itself was targeting.
         
         So we need to disable the logic which checks that the version of Microsoft.NETCore.App from the assets file
         matches the one that would be resolved based on the TargetFramework that was passed in. -->
    <VerifyMatchingImplicitPackageVersion>false</VerifyMatchingImplicitPackageVersion>
  </PropertyGroup>

  <Target Name="BuildDepsJson" DependsOnTargets="$(ResolvePackageDependenciesForBuildDependsOn);GenerateBuildDependencyFile" />

  <Target Name="DontRestore" BeforeTargets="Restore">
    <Error Text="This project should not be restored" />
  </Target>

  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

</Project>