Build csapi with Release configuration
[platform/core/dotnet/build-tools.git] / dotnet / sdk / 2.0.0 / Sdks / Microsoft.NET.Sdk / build / Microsoft.NET.PreserveCompilationContext.targets
1 <!--\r
2 ***********************************************************************************************\r
3 Microsoft.NET.PreserveCompilationContext.targets\r
4 \r
5 WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have\r
6           created a backup copy.  Incorrect changes to this file will make it\r
7           impossible to load or build your projects from the command-line or the IDE.\r
8 \r
9 Copyright (c) .NET Foundation. All rights reserved. \r
10 ***********************************************************************************************\r
11 -->\r
12 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
13 \r
14   <PropertyGroup>\r
15     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>\r
16 \r
17     <RefAssembliesFolderName Condition="'$(RefAssembliesFolderName)' == ''">refs</RefAssembliesFolderName>\r
18   </PropertyGroup>\r
19 \r
20   <Target Name="ComputeDependencyFileCompilerOptions"\r
21           Condition="'$(PreserveCompilationContext)' == 'true'"\r
22           BeforeTargets="GenerateBuildDependencyFile;\r
23                          GeneratePublishDependencyFile">\r
24 \r
25     <ItemGroup>\r
26       <DependencyFileCompilerOptions Include="CompilerOptions">\r
27         <DefineConstants>$(DefineConstants)</DefineConstants>\r
28         <LangVersion>$(LangVersion)</LangVersion>\r
29         <PlatformTarget>$(PlatformTarget)</PlatformTarget>\r
30         <AllowUnsafeBlocks>$(AllowUnsafeBlocks)</AllowUnsafeBlocks>\r
31         <TreatWarningsAsErrors>$(TreatWarningsAsErrors)</TreatWarningsAsErrors>\r
32         <Optimize>$(Optimize)</Optimize>\r
33         <AssemblyOriginatorKeyFile>$(AssemblyOriginatorKeyFile)</AssemblyOriginatorKeyFile>\r
34         <DelaySign>$(DelaySign)</DelaySign>\r
35         <PublicSign>$(DelaySign)</PublicSign>\r
36         <DebugType>$(DebugType)</DebugType>\r
37         <OutputType>$(OutputType)</OutputType>\r
38         <GenerateDocumentationFile>$(GenerateDocumentationFile)</GenerateDocumentationFile>\r
39       </DependencyFileCompilerOptions>\r
40     </ItemGroup>\r
41 \r
42   </Target>\r
43 \r
44   <UsingTask TaskName="FindItemsFromPackages" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />\r
45   <Target Name="ComputeRefAssembliesToPublish"\r
46           Condition="'$(PreserveCompilationContext)' == 'true'"\r
47           DependsOnTargets="_ComputeLockFileCopyLocal;\r
48                             _ParseTargetManifestFiles"\r
49           AfterTargets="ComputeFilesToPublish"\r
50           BeforeTargets="CopyFilesToPublishDirectory">\r
51 \r
52     <FindItemsFromPackages Items="@(_RuntimeCopyLocalItems)"\r
53                            Packages="@(RuntimeStorePackages)">\r
54       <Output TaskParameter="ItemsFromPackages" ItemName="_RuntimeItemsInRuntimeStore"/>\r
55     </FindItemsFromPackages>\r
56 \r
57     <ItemGroup>\r
58       <!--\r
59       Don't copy a compilation assembly if it's also a runtime assembly. There is no need to copy the same\r
60       assembly to the 'refs' folder, if it is already in the publish directory.\r
61       -->\r
62       <_RefAssembliesToExclude Include="@(ResolvedAssembliesToPublish->'%(FullPath)')" />\r
63       <!--\r
64       Similarly, don't copy a compilation assembly if it's also a runtime assembly that is in a runtime store.\r
65       It will be resolved from the runtime store directory at runtime.\r
66       -->\r
67       <_RefAssembliesToExclude Include="@(_RuntimeItemsInRuntimeStore->'%(ResolvedPath)')" />\r
68 \r
69       <ResolvedFileToPublish Include="@(ReferencePath)" Exclude="@(_RefAssembliesToExclude)">\r
70         <RelativePath>$(RefAssembliesFolderName)\%(Filename)%(Extension)</RelativePath>\r
71       </ResolvedFileToPublish>\r
72     </ItemGroup>\r
73 \r
74   </Target>\r
75 \r
76   <!--\r
77     ============================================================\r
78                                         _CopyReferenceOnlyAssembliesForBuild\r
79 \r
80     Copies reference assemblies that normally can't be resolved at runtime to the 'refs' folder in the build output.\r
81     This is necessary in order for the running app to resolve these reference assemblies.\r
82     ============================================================\r
83     -->\r
84   <Target Name="_CopyReferenceOnlyAssembliesForBuild"\r
85           Condition="'$(PreserveCompilationContext)' == 'true'"\r
86           DependsOnTargets="_ComputeReferenceAssemblies"\r
87           AfterTargets="CopyFilesToOutputDirectory">\r
88 \r
89     <Copy SourceFiles="@(_ReferenceOnlyAssemblies)"\r
90           DestinationFolder="$(OutDir)$(RefAssembliesFolderName)"\r
91           SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"\r
92           OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"\r
93           Retries="$(CopyRetryCount)"\r
94           RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"\r
95           UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"\r
96           UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)">\r
97 \r
98       <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>\r
99 \r
100     </Copy>\r
101 \r
102   </Target>\r
103 \r
104 </Project>\r