summaryrefslogtreecommitdiff
path: root/.dotnet/sdk/3.0.100-preview6-012264/Sdks/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Component.targets
blob: 8e5255848c50e4cfda187356b2c93f3135a59b5c (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
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
143
144
145
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
172
173
174
175
176
177
178
179
180
181
182
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
<!--
***********************************************************************************************
Microsoft.NET.Sdk.Razor.Component.targets

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.
***********************************************************************************************
-->

<Project ToolsVersion="14.0">

  <!-- Wire up RazorComponentGenerateCore only once we know we are importing this target file. This prevents avoidable build failures. -->
  <PropertyGroup>
    <RazorComponentGenerateDependsOn>
      $(RazorComponentGenerateDependsOn);
      RazorComponentGenerateCore
    </RazorComponentGenerateDependsOn>
  </PropertyGroup>

  <PropertyGroup>
    <_RazorGenerateComponentDeclarationDesignTimeDependsOn>ResolveRazorConfiguration;ResolveRazorComponentInputs;AssignRazorComponentTargetPaths;RazorGenerateComponentDeclaration</_RazorGenerateComponentDeclarationDesignTimeDependsOn>
    <_RazorGenerateComponentDesignTimeDependsOn>ResolveRazorComponentInputs;AssignRazorComponentTargetPaths</_RazorGenerateComponentDesignTimeDependsOn>
  </PropertyGroup>

  <PropertyGroup>
    <!-- Used for tracking inputs to component generation -->
    <_RazorComponentInputHash></_RazorComponentInputHash>
    <_RazorComponentInputCacheFile>$(IntermediateOutputPath)$(MSBuildProjectName).RazorComponent.input.cache</_RazorComponentInputCacheFile>
  </PropertyGroup>

  <ItemGroup>
    <!-- Path used for the temporary compilation we produce for component discovery -->
    <_RazorComponentDeclarationAssembly Include="$(_RazorComponentDeclarationOutputPath)$(TargetName).dll" />
  </ItemGroup>

  <Target Name="_HashRazorComponentInputs" Condition="'@(RazorComponentWithTargetPath->Count())'!='0'">
    <Hash ItemsToHash="@(RazorComponentWithTargetPath)">
      <Output TaskParameter="HashResult" PropertyName="_RazorComponentInputHash" />
    </Hash>

    <MakeDir
      Directories="$(IntermediateOutputPath)"
      Condition="!Exists('$(IntermediateOutputPath)')" />

    <WriteLinesToFile
      Lines="$(_RazorComponentInputHash)"
      File="$(_RazorComponentInputCacheFile)"
      Overwrite="True"
      WriteOnlyWhenDifferent="True" />

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

  <Target Name="_ResolveRazorComponentOutputs" Condition="'@(RazorComponentWithTargetPath->Count())'!='0'">
    <Error
      Text="RazorComponentWithTargetPath item '%(RazorComponentWithTargetPath.Identity)' does not specify required metadata 'GeneratedDeclaration'."
      Condition="'%(RazorComponentWithTargetPath.GeneratedDeclaration)' == ''" />

    <ItemGroup>
      <_RazorComponentDeclaration Include="@(RazorComponentWithTargetPath->'%(GeneratedDeclaration)')">
        <DependentUpon>%(Identity)</DependentUpon>
      </_RazorComponentDeclaration>
      <_RazorComponentDefinition Include="%(RazorComponentWithTargetPath.GeneratedOutput)" />
    </ItemGroup>
  </Target>

  <PropertyGroup>
    <RazorGenerateComponentDeclarationDependsOn>
      _HashRazorComponentInputs;
      _ResolveRazorComponentOutputs;
    </RazorGenerateComponentDeclarationDependsOn>
  </PropertyGroup>

  <!--
    Generates 'declaration' files for each component, that only have that class and member declarations.
    These files participate in the design-time-build for intellisense, and are used at build-time
    when discovering components for a 'real' build.
  -->
  <Target
    Name="RazorGenerateComponentDeclaration"
    DependsOnTargets="$(RazorGenerateComponentDeclarationDependsOn)"
    Inputs="$(MSBuildAllProjects);@(RazorComponentWithTargetPath);$(_RazorComponentInputCacheFile)"
    Outputs="@(_RazorComponentDeclaration)"
    Condition="'@(RazorComponentWithTargetPath->Count())'!='0'">

    <ItemGroup>
      <_RazorComponentDeclarationSources Include="@(RazorComponentWithTargetPath)">
        <GeneratedOutput>%(RazorComponentWithTargetPath.GeneratedDeclaration)</GeneratedOutput>
      </_RazorComponentDeclarationSources>
    </ItemGroup>

    <MakeDir
      Directories="%(_RazorComponentDeclaration.RelativeDir)"
      Condition="!Exists('%(_RazorComponentDeclaration.RelativeDir)')" />

    <PropertyGroup>
      <!-- This file will not exist, but we need some value -->
      <_RazorComponentDeclarationManifest>$(IntermediateOutputPath)$(MSBuildProjectName).RazorComponents.declaration.json</_RazorComponentDeclarationManifest>
    </PropertyGroup>

    <RazorGenerate
      Debug="$(_RazorDebugGenerateCodeTask)"
      DebugTool="$(_RazorDebugGenerateCodeTool)"
      ToolAssembly="$(_RazorToolAssembly)"
      UseServer="$(UseRazorBuildServer)"
      ForceServer="$(_RazorForceBuildServer)"
      PipeName="$(_RazorBuildServerPipeName)"
      Version="$(RazorLangVersion)"
      RootNamespace="$(RootNamespace)"
      CSharpLanguageVersion="$(LangVersion)"
      Configuration="@(ResolvedRazorConfiguration)"
      Extensions="@(ResolvedRazorExtension)"
      Sources="@(_RazorComponentDeclarationSources)"
      ProjectRoot="$(MSBuildProjectDirectory)"
      TagHelperManifest="$(_RazorComponentDeclarationManifest)"
      GenerateDeclaration="true" />

    <ItemGroup>
      <FileWrites Include="@(_RazorComponentDeclaration)" />
    </ItemGroup>

    <ItemGroup Condition="'$(DesignTimeBuild)'=='true'">
      <Compile Include="@(_RazorComponentDeclaration)" />
    </ItemGroup>
  </Target>

  <Target
    Name="RazorCompileComponentDeclaration"
    Inputs="
      $(MSBuildAllProjects);
      @(_RazorComponentDeclaration);
      @(Compile);
      $(AssemblyOriginatorKeyFile);
      @(ReferencePathWithRefAssemblies);
      @(CompiledLicenseFile);
      @(LinkResource);
      $(ResolvedCodeAnalysisRuleSet);
      @(AdditionalFiles)"
    Outputs="@(_RazorComponentDeclarationAssembly);$(NonExistentFile)"
    Condition="'$(DesignTimeBuild)'!='true' AND '$(Language)'=='C#' AND '@(_RazorComponentDeclaration)' != ''">

    <MakeDir Directories="%(_RazorComponentDeclarationAssembly.RelativeDir)" />

    <!-- These two compiler warnings are raised when a reference is bound to a different version
             than specified in the assembly reference version number.  MSBuild raises the same warning in this case,
             so the compiler warning would be redundant. -->
    <PropertyGroup Condition="('$(TargetFrameworkVersion)' != 'v1.0') and ('$(TargetFrameworkVersion)' != 'v1.1')">
      <NoWarn>$(NoWarn);1701;1702</NoWarn>
    </PropertyGroup>

    <PropertyGroup>
      <!-- To match historical behavior, when inside VS11+ disable the warning from csc.exe indicating that no sources were passed in-->
      <NoWarn Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(VisualStudioVersion)' != '' AND '$(VisualStudioVersion)' &gt; '10.0'">$(NoWarn);2008</NoWarn>
    </PropertyGroup>

    <PropertyGroup>
      <!-- If the user has specified AppConfigForCompiler, we'll use it. If they have not, but they set UseAppConfigForCompiler,
                 then we'll use AppConfig -->
      <AppConfigForCompiler Condition="'$(AppConfigForCompiler)' == '' AND '$(UseAppConfigForCompiler)' == 'true'">$(AppConfig)</AppConfigForCompiler>
    </PropertyGroup>

    <!-- Prefer32Bit was introduced in .NET 4.5. Set it to false if we are targeting 4.0 -->
    <PropertyGroup Condition="('$(TargetFrameworkVersion)' == 'v4.0')">
      <Prefer32Bit>false</Prefer32Bit>
    </PropertyGroup>

    <!-- TODO: Remove this ItemGroup once it has been moved to "_GenerateCompileInputs" target in Microsoft.Common.CurrentVersion.targets.
         https://github.com/dotnet/roslyn/issues/12223 -->
    <ItemGroup Condition="('$(AdditionalFileItemNames)' != '')">
      <AdditionalFileItems Include="$(AdditionalFileItemNames)" />
      <AdditionalFiles Include="@(%(AdditionalFileItems.Identity))" />
    </ItemGroup>

    <PropertyGroup Condition="'$(UseSharedCompilation)' == ''">
      <UseSharedCompilation>true</UseSharedCompilation>
    </PropertyGroup>

    <PropertyGroup>
      <LangVersion Condition="'$(LangVersion)' == '' AND
        (('$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(TargetFrameworkVersion)' == 'v3.0') OR
         ('$(TargetFrameworkIdentifier)' == '.NETStandard' AND '$(TargetFrameworkVersion)' == 'v2.1'))">8.0</LangVersion>
    </PropertyGroup>

    <Csc
         AdditionalLibPaths="$(AdditionalLibPaths)"
         AddModules="@(AddModules)"
         AdditionalFiles="@(AdditionalFiles)"
         AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
         Analyzers="@(Analyzer)"
         ApplicationConfiguration="$(AppConfigForCompiler)"
         BaseAddress="$(BaseAddress)"
         CheckForOverflowUnderflow="$(CheckForOverflowUnderflow)"
         ChecksumAlgorithm="$(ChecksumAlgorithm)"
         CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)"
         CodePage="$(CodePage)"
         DebugType="$(DebugType)"
         DefineConstants="$(DefineConstants)"
         DelaySign="$(DelaySign)"
         DisabledWarnings="$(NoWarn)"
         EmitDebugInformation="$(DebugSymbols)"
         EnvironmentVariables="$(CscEnvironment)"
         ErrorEndLocation="$(ErrorEndLocation)"
         ErrorLog="$(ErrorLog)"
         ErrorReport="$(ErrorReport)"
         Features="$(Features)"
         FileAlignment="$(FileAlignment)"
         GenerateFullPaths="$(GenerateFullPaths)"
         HighEntropyVA="$(HighEntropyVA)"
         Instrument="$(Instrument)"
         KeyContainer="$(KeyContainerName)"
         KeyFile="$(KeyOriginatorFile)"
         LangVersion="$(LangVersion)"
         LinkResources="@(LinkResource)"
         ModuleAssemblyName="$(ModuleAssemblyName)"
         NoConfig="true"
         NoLogo="$(NoLogo)"
         NoStandardLib="$(NoCompilerStandardLib)"
         NoWin32Manifest="$(NoWin32Manifest)"
         NullableContextOptions="$(NullableContextOptions)"
         Optimize="$(Optimize)"
         Deterministic="$(Deterministic)"
         PublicSign="$(PublicSign)"
         OutputAssembly="@(_RazorComponentDeclarationAssembly)"
         Platform="$(PlatformTarget)"
         Prefer32Bit="$(Prefer32Bit)"
         PreferredUILang="$(PreferredUILang)"
         ProvideCommandLineArgs="$(ProvideCommandLineArgs)"
         References="@(ReferencePathWithRefAssemblies)"
         ReportAnalyzer="$(ReportAnalyzer)"
         Resources="@(CompiledLicenseFile)"
         ResponseFiles="$(CompilerResponseFile)"
         RuntimeMetadataVersion="$(RuntimeMetadataVersion)"
         SharedCompilationId="$(SharedCompilationId)"
         SkipCompilerExecution="$(SkipCompilerExecution)"
         Sources="@(_RazorComponentDeclaration);@(Compile)"
         SubsystemVersion="$(SubsystemVersion)"
         TargetType="$(OutputType)"
         ToolExe="$(CscToolExe)"
         ToolPath="$(CscToolPath)"
         TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
         UseHostCompilerIfAvailable="$(UseHostCompilerIfAvailable)"
         UseSharedCompilation="$(UseSharedCompilation)"
         Utf8Output="$(Utf8Output)"
         VsSessionGuid="$(VsSessionGuid)"
         WarningLevel="$(WarningLevel)"
         WarningsAsErrors="$(WarningsAsErrors)"
         WarningsNotAsErrors="$(WarningsNotAsErrors)"
         PathMap="$(PathMap)"
         SourceLink="$(SourceLink)">
      <Output TaskParameter="CommandLineArgs" ItemName="CscCommandLineArgs" />
    </Csc>

    <ItemGroup>
      <FileWrites Include="@(_RazorComponentDeclarationAssembly)" Condition="Exists('@(_RazorComponentDeclarationAssembly)')" />
    </ItemGroup>
  </Target>

  <Target Name="_ResolveComponentRazorGenerateInputs">
    <ItemGroup>
      <!-- Add RazorComponent files to the set of files to be code-gened. -->
      <RazorGenerateWithTargetPath Include="@(RazorComponentWithTargetPath)" />
    </ItemGroup>

    <!-- Point to the declaration assembly to perform taghelper discovery -->
    <PropertyGroup>
      <_RazorComponentDeclarationAssemblyFullPath>@(_RazorComponentDeclarationAssembly->Metadata('FullPath'))</_RazorComponentDeclarationAssemblyFullPath>
    </PropertyGroup>
  </Target>

  <!-- 
    Once RazorCompileComponentDeclaration is completed, we have all the inputs required for code generation of
    RazorComponents and RazorGenerate items. We'll initialize the inputs for RazorGenerate and invoke it.
    This should result in RazorGenerate \ RazorTagHelper targets no-oping when it get invoked as 
    part of PrepareForRun \ PrepareForPublish for non-components (.cshtml) files.
   -->
  <Target
    Name="RazorGenerateComponentDefinition"
    DependsOnTargets="_ResolveComponentRazorGenerateInputs;RazorGenerate"
    Condition="'$(DesignTimeBuild)' != 'true' AND '@(_RazorComponentDefinition->Count())' != '0' AND Exists('@(_RazorComponentDeclarationAssembly)')">

    <ItemGroup Condition="'$(DesignTimeBuild)' != 'true'">
      <Compile Include="@(_RazorComponentDefinition)" />
    </ItemGroup>
  </Target>

  <PropertyGroup>
    <RazorComponentGenerateCoreDependsOn>
      RazorGenerateComponentDeclaration;
      RazorCompileComponentDeclaration;
      RazorGenerateComponentDefinition;
    </RazorComponentGenerateCoreDependsOn>
  </PropertyGroup>

  <Target Name="RazorComponentGenerateCore" DependsOnTargets="$(RazorComponentGenerateCoreDependsOn)">
  </Target>

</Project>