[Tizen] Update build tools to 2.1.0-rc1-03006-01
[platform/upstream/coreclr.git] / Tools / Microsoft.CSharp.CurrentVersion.targets
1 <!--
2 ***********************************************************************************************
3 Microsoft.CSharp.CurrentVersion.targets
4
5 WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6           created a backup copy.  Incorrect changes to this file will make it
7           impossible to load or build your projects from the command-line or the IDE.
8
9 This file defines the steps in the standard build process specific for C# .NET projects.
10 For example, it contains the step that actually calls the C# compiler.  The remainder
11 of the build process is defined in Microsoft.Common.targets, which is imported by 
12 this file.
13
14 Copyright (C) Microsoft Corporation. All rights reserved.
15 ***********************************************************************************************
16 -->
17
18 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
19
20     <PropertyGroup>
21        <ImportByWildcardBeforeMicrosoftCSharpTargets Condition="'$(ImportByWildcardBeforeMicrosoftCSharpTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCSharpTargets>
22        <ImportByWildcardAfterMicrosoftCSharpTargets Condition="'$(ImportByWildcardAfterMicrosoftCSharpTargets)' == ''">true</ImportByWildcardAfterMicrosoftCSharpTargets>
23        <ImportUserLocationsByWildcardBeforeMicrosoftCSharpTargets Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCSharpTargets)' == ''">true</ImportUserLocationsByWildcardBeforeMicrosoftCSharpTargets>
24        <ImportUserLocationsByWildcardAfterMicrosoftCSharpTargets Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCSharpTargets)' == ''">true</ImportUserLocationsByWildcardAfterMicrosoftCSharpTargets>
25     </PropertyGroup>
26
27     <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportBefore\*" Condition="'$(ImportUserLocationsByWildcardBeforeMicrosoftCSharpTargets)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportBefore')"/>
28     <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftCSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportBefore')"/>
29
30     <PropertyGroup>
31        <CustomBeforeMicrosoftCSharpTargets Condition="'$(CustomBeforeMicrosoftCSharpTargets)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.Before.Microsoft.CSharp.targets</CustomBeforeMicrosoftCSharpTargets>
32        <CustomAfterMicrosoftCSharpTargets Condition="'$(CustomAfterMicrosoftCSharpTargets)'==''">$(MSBuildExtensionsPath)\v$(MSBuildToolsVersion)\Custom.After.Microsoft.CSharp.targets</CustomAfterMicrosoftCSharpTargets>
33     </PropertyGroup>
34
35     <Import Project="$(CustomBeforeMicrosoftCSharpTargets)" Condition="'$(CustomBeforeMicrosoftCSharpTargets)' != '' and Exists('$(CustomBeforeMicrosoftCSharpTargets)')" />
36
37     <PropertyGroup>
38         <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
39         <DefaultLanguageSourceExtension>.cs</DefaultLanguageSourceExtension>
40         <Language>C#</Language>
41         <TargetRuntime>Managed</TargetRuntime>
42         <AlwaysUseNumericalSuffixInItemNames>true</AlwaysUseNumericalSuffixInItemNames>
43         <DefineCommonItemSchemas Condition=" '$(DefineCommonItemSchemas)' == '' ">true</DefineCommonItemSchemas>
44         <DefineCommonReferenceSchemas Condition=" '$(DefineCommonReferenceSchemas)' == '' ">true</DefineCommonReferenceSchemas>
45         <DefineCommonCapabilities Condition=" '$(DefineCommonCapabilities)' == '' ">true</DefineCommonCapabilities>
46         <SynthesizeLinkMetadata Condition=" '$(SynthesizeLinkMetadata)' == '' and '$(HasSharedItems)' == 'true' ">true</SynthesizeLinkMetadata>
47         <DefaultProjectTypeGuid Condition=" '$(DefaultProjectTypeGuid)' == '' ">{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</DefaultProjectTypeGuid>
48         <AppDesignerFolder Condition="'$(AppDesignerFolder)' == ''">Properties</AppDesignerFolder>
49     </PropertyGroup>
50
51     <ItemGroup Condition=" '$(DefineCSharpItemSchemas)' != 'false' ">
52         <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)CSharp.ProjectItemsSchema.xaml;"/>
53         <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)CSharp.xaml;">
54             <Context>File</Context>
55         </PropertyPageSchema>
56         <PropertyPageSchema Include="$(CommonXamlResourcesDirectory)CSharp.BrowseObject.xaml;">
57             <Context>BrowseObject</Context>
58         </PropertyPageSchema>
59
60         <ProjectCapability Include="CSharp;Managed"/>
61     </ItemGroup>
62
63     <ItemGroup Condition=" '$(DefineCommonCapabilities)' == 'true' ">
64       <ProjectCapability Include="ReferencesFolder;LanguageService" />
65     </ItemGroup>
66
67     <!--
68     The CreateManifestResourceNames target create the manifest resource names from the .RESX
69     files.
70     
71         [IN]
72         @(EmbeddedResource) - The list of EmbeddedResource items that have been pre-processed to add metadata about resource type
73                               Expected Metadata "Type" can either be "Resx" or "Non-Resx"
74
75         [OUT]
76         @(EmbeddedResource) - EmbeddedResource items with metadata         
77         
78     For C# applications the transformation is like:
79
80         Resources1.resx => RootNamespace.Resources1 => Build into main assembly
81         SubFolder\Resources1.resx => RootNamespace.SubFolder.Resources1 => Build into main assembly
82         Resources1.fr.resx => RootNamespace.Resources1.fr => Build into satellite assembly
83         Resources1.notaculture.resx => RootNamespace.Resources1.notaculture => Build into main assembly
84
85     For other project systems, this transformation may be different.
86     -->
87     <PropertyGroup>
88         <CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
89     </PropertyGroup>
90     <Target
91         Name="CreateManifestResourceNames"
92         Condition="'@(EmbeddedResource)' != ''"
93         DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"
94         >
95
96         <ItemGroup>
97             <_Temporary Remove="@(_Temporary)" />
98         </ItemGroup>
99         
100         <!-- Create manifest names for culture and non-culture Resx files, and for non-culture Non-Resx resources -->
101         <CreateCSharpManifestResourceName
102               ResourceFiles="@(EmbeddedResource)"
103               RootNamespace="$(RootNamespace)"              
104               Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx')">
105
106             <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
107
108         </CreateCSharpManifestResourceName>
109         
110         <!-- Create manifest names for all culture non-resx resources -->
111         <CreateCSharpManifestResourceName
112               ResourceFiles="@(EmbeddedResource)"
113               RootNamespace="$(RootNamespace)"
114               PrependCultureAsDirectory="false"
115               Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx'">
116
117             <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />
118
119         </CreateCSharpManifestResourceName>
120
121         <ItemGroup>
122             <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
123             <EmbeddedResource Include="@(_Temporary)" />
124             <_Temporary Remove="@(_Temporary)" />
125         </ItemGroup>
126               
127     </Target>
128
129     <Target
130         Name="ResolveCodeAnalysisRuleSet"
131         Condition="'$(CodeAnalysisRuleSet)' != ''"
132         >
133
134         <ResolveCodeAnalysisRuleSet
135             CodeAnalysisRuleSet="$(CodeAnalysisRuleSet)"
136             CodeAnalysisRuleSetDirectories="$(CodeAnalysisRuleSetDirectories)"
137             MSBuildProjectDirectory="$(MSBuildProjectDirectory)">
138
139             <Output TaskParameter="ResolvedCodeAnalysisRuleSet" PropertyName="ResolvedCodeAnalysisRuleSet" />
140
141         </ResolveCodeAnalysisRuleSet>
142
143     </Target>
144
145     <ItemGroup>
146         <!-- Activate CPS projects to track folder names in namespace. -->
147         <ProjectCapability Include="RelativePathDerivedDefaultNamespace"/>
148     </ItemGroup>
149
150     <PropertyGroup>
151         <!-- Provide a facility to override UseHostCompilerIfAvailable-->
152         <UseHostCompilerIfAvailable Condition=" '$(UseHostCompilerIfAvailable)' == ''">true</UseHostCompilerIfAvailable>
153     </PropertyGroup>
154
155     <ItemGroup>
156         <DocFileItem Include="$(DocumentationFile)" Condition="'$(DocumentationFile)'!=''"/>
157     </ItemGroup>
158
159     <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
160         <_DebugSymbolsIntermediatePathTemporary Include="$(PdbFile)"/>
161         <!-- Add any missing .pdb extension, as the compiler does -->
162         <_DebugSymbolsIntermediatePath Include="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
163     </ItemGroup>
164
165     <PropertyGroup>
166         <CoreCompileDependsOn>_ComputeNonExistentFileProperty;ResolveCodeAnalysisRuleSet</CoreCompileDependsOn>
167         <ExportWinMDFile Condition="'$(ExportWinMDFile)' == '' and '$(OutputType)' == 'WinMDObj'">true</ExportWinMDFile>
168     </PropertyGroup>
169  
170 <!--
171       The XamlPreCompile target must remain identical to
172       the CoreCompile target in Microsoft.CSharp.Core.targets.
173       Any updates to one must be made to the other.
174 -->
175      <Target
176         Name="XamlPreCompile"
177         Inputs="$(MSBuildAllProjects);
178                 @(Compile);
179                 @(_CoreCompileResourceInputs);
180                 $(ApplicationIcon);
181                 $(AssemblyOriginatorKeyFile);
182                 @(ReferencePath);
183                 @(CompiledLicenseFile);
184                 @(LinkResource);
185                 @(EmbeddedDocumentation); 
186                 $(Win32Resource);
187                 $(Win32Manifest);
188                 @(CustomAdditionalCompileInputs);
189                 @(Page);
190                 @(ApplicationDefinition);
191                 $(ResolvedCodeAnalysisRuleSet)"
192                   
193         Outputs="@(DocFileItem);
194                  @(XamlIntermediateAssembly);
195                  @(_DebugSymbolsIntermediatePath);
196                  $(NonExistentFile);
197                  @(CustomAdditionalCompileOutputs)"
198         Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != ''"
199         Returns=""
200         DependsOnTargets="$(CoreCompileDependsOn)"
201     >
202        <!-- These two compiler warnings are raised when a reference is bound to a different version
203              than specified in the assembly reference version number.  MSBuild raises the same warning in this case,
204              so the compiler warning would be redundant. -->
205         <PropertyGroup Condition="('$(TargetFrameworkVersion)' != 'v1.0') and ('$(TargetFrameworkVersion)' != 'v1.1')">
206             <NoWarn>$(NoWarn);1701;1702</NoWarn>
207         </PropertyGroup>
208
209         <PropertyGroup>
210             <!-- To match historical behavior, when inside VS11+ disable the warning from csc.exe indicating that no sources were passed in-->
211             <NoWarn Condition=" '$(BuildingInsideVisualStudio)' == 'true' and '$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' > '10.0' ">$(NoWarn);2008</NoWarn>
212         </PropertyGroup>
213
214         <ItemGroup Condition="'$(TargetingClr2Framework)'=='true'">
215             <ReferencePath>
216                 <EmbedInteropTypes/>
217             </ReferencePath>
218         </ItemGroup>
219         
220         <PropertyGroup>
221             <!-- If the user has specified AppConfigForCompiler, we'll use it. If they have not, but they set UseAppConfigForCompiler,
222                  then we'll use AppConfig -->
223             <AppConfigForCompiler Condition="'$(AppConfigForCompiler)' == '' and '$(UseAppConfigForCompiler)' == 'true'">$(AppConfig)</AppConfigForCompiler>
224             
225             <!-- If we are targeting winmdobj we want to specifically the pdbFile property since we do not want it to collide with the output of winmdexp--> 
226             <PdbFile Condition="'$(PdbFile)' == '' and '$(OutputType)' == 'winmdobj' and '$(_DebugSymbolsProduced)' == 'true'">$(IntermediateOutputPath)$(TargetName).compile.pdb</PdbFile>
227         </PropertyGroup>
228
229         <!-- Prefer32Bit was introduced in .NET 4.5. Set it to false if we are targeting 4.0 -->
230         <PropertyGroup Condition="('$(TargetFrameworkVersion)' == 'v4.0')">
231             <Prefer32Bit>false</Prefer32Bit>
232         </PropertyGroup>
233        
234         <ItemGroup Condition="('$(AdditionalFileItemNames)' != '')">
235           <AdditionalFileItems Include="$(AdditionalFileItemNames)" />
236           <AdditionalFiles Include="@(%(AdditionalFileItems.Identity))" />
237         </ItemGroup>
238         
239        <!-- Don't run analyzers for Csc task on XamlPrecompile pass, we only want to run them on core compile. -->
240        <!-- Analyzers="@(Analyzer)" -->
241
242        <PropertyGroup Condition="'$(UseSharedCompilation)' == ''">
243          <UseSharedCompilation>true</UseSharedCompilation>
244        </PropertyGroup>
245
246        <!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
247         <Csc  Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
248               AdditionalLibPaths="$(AdditionalLibPaths)"
249               AddModules="@(AddModules)"
250               AdditionalFiles="@(AdditionalFiles)"
251               AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
252               ApplicationConfiguration="$(AppConfigForCompiler)"
253               BaseAddress="$(BaseAddress)"
254               CheckForOverflowUnderflow="$(CheckForOverflowUnderflow)"
255               CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)"
256               CodePage="$(CodePage)"
257               DebugType="$(DebugType)"
258               DefineConstants="$(DefineConstants)"
259               DelaySign="$(DelaySign)"
260               DisabledWarnings="$(NoWarn)"
261               DocumentationFile="@(DocFileItem)"
262               EmitDebugInformation="$(DebugSymbols)"
263               EnvironmentVariables="$(CscEnvironment)"              
264               ErrorEndLocation="$(ErrorEndLocation)"
265               ErrorLog="$(ErrorLog)"
266               ErrorReport="$(ErrorReport)"
267               FileAlignment="$(FileAlignment)"
268               GenerateFullPaths="$(GenerateFullPaths)"
269               HighEntropyVA="$(HighEntropyVA)"
270               KeyContainer="$(KeyContainerName)"
271               KeyFile="$(KeyOriginatorFile)"
272               LangVersion="$(LangVersion)"
273               LinkResources="@(LinkResource)"
274               MainEntryPoint="$(StartupObject)"
275               ModuleAssemblyName="$(ModuleAssemblyName)"
276               NoConfig="true"
277               NoLogo="$(NoLogo)"
278               NoStandardLib="$(NoCompilerStandardLib)"
279               NoWin32Manifest="$(NoWin32Manifest)"
280               Optimize="$(Optimize)"
281               OutputAssembly="@(XamlIntermediateAssembly)"
282               PdbFile="$(PdbFile)" 
283               Platform="$(PlatformTarget)"
284               Prefer32Bit="$(Prefer32Bit)"
285               PreferredUILang="$(PreferredUILang)"
286               References="@(ReferencePath)"
287               ReportAnalyzer="$(ReportAnalyzer)"
288               Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile)"
289               ResponseFiles="$(CompilerResponseFile)"
290               Sources="@(Compile)"
291               SubsystemVersion="$(SubsystemVersion)"
292               TargetType="$(OutputType)"
293               ToolExe="$(CscToolExe)"
294               ToolPath="$(CscToolPath)"
295               TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
296               UseHostCompilerIfAvailable="$(UseHostCompilerIfAvailable)"
297               UseSharedCompilation="$(UseSharedCompilation)"
298               Utf8Output="$(Utf8Output)"
299               VsSessionGuid="$(VsSessionGuid)"
300               WarningLevel="$(WarningLevel)"
301               WarningsAsErrors="$(WarningsAsErrors)"
302               WarningsNotAsErrors="$(WarningsNotAsErrors)"
303               Win32Icon="$(ApplicationIcon)"
304               Win32Manifest="$(Win32Manifest)"
305               Win32Resource="$(Win32Resource)"
306               />
307
308 <!-- Only Applicable to the regular CoreCompile:
309               <ItemGroup>
310                   <_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
311               </ItemGroup>
312
313               <CallTarget Targets="$(TargetsTriggeredByCompilation)" Condition="'$(TargetsTriggeredByCompilation)' != ''"/>
314 -->
315         <OnError Condition="'$(OnXamlPreCompileErrorTarget)' != ''" ExecuteTargets="$(OnXamlPreCompileErrorTarget)" />
316     </Target>
317
318     <PropertyGroup>
319         <CSharpCoreTargetsPath Condition="'$(CSharpCoreTargetsPath)' == ''">$(RoslynTargetsPath)\Microsoft.CSharp.Core.targets</CSharpCoreTargetsPath>
320     </PropertyGroup>
321
322     <Import Project="$(CSharpCoreTargetsPath)" />
323     
324     <!-- Import design time targets for Roslyn Project System. These are only available if Visual Studio is installed. -->
325     <!-- Import design time targets before the common targets, which import targets from Nuget. -->
326     <PropertyGroup>
327        <CSharpDesignTimeTargetsPath Condition="'$(CSharpDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets</CSharpDesignTimeTargetsPath>
328     </PropertyGroup>
329     <Import Project="$(CSharpDesignTimeTargetsPath)" Condition="'$(CSharpDesignTimeTargetsPath)' != '' and Exists('$(CSharpDesignTimeTargetsPath)')" />
330
331     <Import Project="Microsoft.Common.targets" />
332     <Import Project="$(MSBuildToolsPath)\Microsoft.ServiceModel.targets" Condition="('$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0' and '$(TargetFrameworkVersion)' != 'v3.5') and Exists('$(MSBuildToolsPath)\Microsoft.ServiceModel.targets')"/>
333
334     <Target Name="_SetTargetFrameworkMonikerAttribute" BeforeTargets="GenerateTargetFrameworkMonikerAttribute">
335        <PropertyGroup>
336        <TargetFrameworkMonikerAssemblyAttributeText Condition="'$(TargetFrameworkMoniker)' != '' and '$(TargetingClr2Framework)' != 'true'">
337 // &lt;autogenerated /&gt;
338 using System%3b
339 using System.Reflection%3b
340 [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(&quot;$(TargetFrameworkMoniker)&quot;, FrameworkDisplayName = &quot;$(TargetFrameworkMonikerDisplayName)&quot;)]
341         </TargetFrameworkMonikerAssemblyAttributeText>
342         </PropertyGroup>
343     </Target>
344
345     <PropertyGroup>
346        <Utf8Output Condition="'$(Utf8Output)' == ''">true</Utf8Output>
347
348       <!-- NoCompilerStandardLib maps to the compiler's /nostdlib option. By default we always
349            want that switch to be passed to the compiler so that either we or the user
350            provides the references
351            NoStdLib on the other hand indicates that the user doesn't want standard references
352            so only if NoStdLib isn't set to true, will we provide the standard references
353       -->
354       <NoCompilerStandardLib Condition=" '$(NoCompilerStandardLib)' == '' ">true</NoCompilerStandardLib>
355
356       <ErrorEndLocation Condition="'$(BuildingInsideVisualStudio)' == 'true' and '$(ErrorEndLocation)' == ''">true</ErrorEndLocation>
357
358        <!-- When building inside VS, by default use the same language for compiler messages as VS itself does. -->
359        <PreferredUILang Condition="'$(BuildingInsideVisualStudio)' == 'true' and '$(PreferredUILang)' == ''">$([System.Globalization.CultureInfo]::CurrentUICulture.Name)</PreferredUILang>
360     </PropertyGroup>
361     
362     <!-- Add any "automatic" compiler references that need to be resolved when NoCompilerStandardLib is set
363          but the user hasn't told us to not include standard references -->
364     <ItemGroup Condition=" '$(NoCompilerStandardLib)' == 'true' and '$(NoStdLib)' != 'true' ">
365       <!-- Note that unlike VB, C# does not automatically locate System.dll as a "standard library"
366            instead the reference is always passed from the project. Also, for mscorlib.dll 
367            we need to provide the explicit location in order to maintain the correct behaviour
368       -->
369         <_ExplicitReference Include="$(FrameworkPathOverride)\mscorlib.dll" />
370     </ItemGroup>
371
372     <Import Project="$(CustomAfterMicrosoftCSharpTargets)" Condition="'$(CustomAfterMicrosoftCSharpTargets)' != '' and Exists('$(CustomAfterMicrosoftCSharpTargets)')" />
373
374     <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftCSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter')"/>
375     <Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCSharpTargets)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter')"/>
376
377 </Project>