|
4 | 4 | </PropertyGroup> |
5 | 5 |
|
6 | 6 | <Import Project="..\dir.targets" /> |
7 | | - |
8 | | - <PropertyGroup Condition=" '$(TargetFrameworkIdentifier)' == '' |
9 | | - and '$(TargetFrameworkVersion)' == '' |
10 | | - and '$(TargetFrameworkProfile)' == '' "> |
11 | | - <TargetingDefaultPlatform>true</TargetingDefaultPlatform> |
12 | | - </PropertyGroup> |
13 | | - |
14 | | - <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == ''"> |
15 | | - <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier> |
16 | | - </PropertyGroup> |
17 | | - |
18 | | - <!-- |
19 | | - Limit the assembly resolution to just explicit locations. |
20 | | - Don't search anything machine-wide or build-order dependent. |
21 | | - --> |
22 | | - <PropertyGroup> |
23 | | - <AssemblySearchPaths>{HintPathFromItem};{RawFileName}</AssemblySearchPaths> |
24 | | - </PropertyGroup> |
25 | | - |
26 | | - <!-- |
27 | | - When targeting an explicit platform other than the default, |
28 | | - also allow the target framework directory. |
29 | | - --> |
30 | | - <PropertyGroup Condition="'$(TargetingDefaultPlatform)' != 'true'"> |
31 | | - <AssemblySearchPaths>$(AssemblySearchPaths);{TargetFrameworkDirectory}</AssemblySearchPaths> |
32 | | - </PropertyGroup> |
33 | | - |
34 | | - <!-- Setup the default target for projects not already explicitly targeting another platform --> |
35 | | - <PropertyGroup Condition="'$(TargetingDefaultPlatform)' == 'true'"> |
36 | | - <!-- Setting a default portable profile, although nothing should resolve from there as we want to use the pacakge refs --> |
37 | | - <TargetPlatformIdentifier>Portable</TargetPlatformIdentifier> |
38 | | - <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier> |
39 | | - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
40 | | - <TargetFrameworkProfile>Profile7</TargetFrameworkProfile> |
41 | | - <TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName> |
42 | | - <ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework> |
43 | | - </PropertyGroup> |
44 | | - |
45 | | - |
46 | | - <!-- Need to add references to the mscorlib design-time facade for some old-style portable dependencies like xunit --> |
47 | | - <Target Name="AddDesignTimeFacadeReferences" |
48 | | - Condition="'$(TargetingDefaultPlatform)' == 'true'" |
49 | | - BeforeTargets="ResolveReferences" |
50 | | - DependsOnTargets="GetReferenceAssemblyPaths" |
51 | | - > |
52 | | - <ItemGroup> |
53 | | - <PossibleTargetFrameworks Include="$(_TargetFrameworkDirectories)" /> |
54 | | - <ReferencePath Include="%(PossibleTargetFrameworks.Identity)mscorlib.dll" |
55 | | - Condition="'%(PossibleTargetFrameworks.Identity)' != '' and Exists('%(PossibleTargetFrameworks.Identity)mscorlib.dll')" /> |
56 | | - </ItemGroup> |
57 | | - </Target> |
58 | | - |
59 | | - <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" |
60 | | - Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable'" /> |
61 | | - |
62 | | - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" |
63 | | - Condition="'$(TargetFrameworkIdentifier)' != '.NETPortable'" /> |
64 | | - |
65 | | - <!-- Restore packages --> |
66 | | - <PropertyGroup> |
67 | | - <PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig> |
68 | | - <RestorePackages Condition="'$(RestorePackages)' == '' and Exists('$(PackagesConfig)')">true</RestorePackages> |
69 | | - <RestorePackagesSemaphore>$(PackagesDir)$(MSBuildProjectFile)-packages.config</RestorePackagesSemaphore> |
70 | | - </PropertyGroup> |
71 | | - |
72 | | - <Target Name="RestorePackages" |
73 | | - BeforeTargets="ResolveNuGetPackages" |
74 | | - Inputs="$(PackagesConfig)" |
75 | | - Outputs="$(RestorePackagesSemaphore)" |
76 | | - Condition="'$(RestorePackages)' == 'true'"> |
77 | | - <Exec Command="$(NugetRestoreCommand) "$(PackagesConfig)"" StandardOutputImportance="Low" /> |
78 | | - <Copy SourceFiles="$(PackagesConfig)" DestinationFiles="$(RestorePackagesSemaphore)" ContinueOnError="True" SkipUnchangedFiles="True" /> |
79 | | - </Target> |
80 | | - |
81 | | - <Import Project="$(ToolsDir)packageresolve.targets" Condition="Exists('$(ToolsDir)packageresolve.targets')" /> |
82 | | - |
83 | | - <!-- Version assemblies --> |
84 | | - <PropertyGroup> |
85 | | - <!-- |
86 | | - For now to avoid conflicts with files coming from packages default assembly version to 999.999.999.999 |
87 | | - until we correctly add the AssemblyVersion property to each of the projects. |
88 | | - --> |
89 | | - <AssemblyVersion Condition="'$(AssemblyVersion)'==''">999.999.999.999</AssemblyVersion> |
90 | | - <GenerateAssemblyInfo Condition="'$(GenerateAssemblyInfo)'==''">true</GenerateAssemblyInfo> |
91 | | - <CLSCompliant Condition="'$(CLSCompliant)'==''">true</CLSCompliant> |
92 | | - </PropertyGroup> |
93 | | - |
94 | | - <Import Project="$(ToolsDir)versioning.targets" Condition="Exists('$(ToolsDir)versioning.targets')" /> |
95 | | - |
96 | | - <Import Project="$(ToolsDir)publishtest.targets" Condition="Exists('$(ToolsDir)publishtest.targets')" /> |
97 | | - |
98 | | - <PropertyGroup> |
99 | | - <IsTestProject Condition="'$(IsTestProject)'=='' And $(MSBuildProjectName.EndsWith('.Tests'))">True</IsTestProject> |
100 | | - <CLSCompliant Condition="'$(IsTestProject)'=='True'">false</CLSCompliant> |
101 | | - </PropertyGroup> |
102 | | - |
103 | | - <!-- VS does not evaluate the conditions when loading the projects and so we add this via a target file and import it with a condition --> |
104 | | - <!-- |
105 | | - Disable temporarily until we can get this working in both TFS and Github |
106 | | - <Import Project="$(ToolsDir)resources.targets" /> |
107 | | - --> |
108 | | - |
109 | | - <PropertyGroup> |
110 | | - <ResourcesSourceOutputDirectory Condition="'$(ResourcesSourceOutputDirectory)' == ''">$(MSBuildProjectDirectory)\Resources</ResourcesSourceOutputDirectory> |
111 | | - <StringResourcesPath Condition="'$(StringResourcesPath)'=='' And Exists('$(ResourcesSourceOutputDirectory)\Strings.resx')">$(ResourcesSourceOutputDirectory)\Strings.resx</StringResourcesPath> |
112 | | - <ResourceSRPath Condition="'$(ResourceSRPath)'=='' And '$(MSBuildProjectExtension)' == '.csproj'">$(ResourcesSourceOutputDirectory)\SR.cs</ResourceSRPath> |
113 | | - </PropertyGroup> |
114 | | - |
115 | | - <Import Project="$(ToolsDir)ResourcesIncludes.targets" Condition="Exists('$(ToolsDir)ResourcesIncludes.targets') and Exists('$(StringResourcesPath)') And Exists('$(ResourceSRPath)') And '$(SkipResourcesIncludesTarget)'==''"/> |
116 | | - |
117 | | - <!-- sign.targets relies on the value of IsTestProject so be sure to import it after it's defined --> |
118 | | - <Import Project="$(ToolsDir)sign.targets" Condition="Exists('$(ToolsDir)sign.targets')" /> |
119 | | - |
120 | | - <PropertyGroup> |
121 | | - <TestRuntimePackageConfig>$(ToolsDir)test-runtime\packages.config</TestRuntimePackageConfig> |
122 | | - <TestRuntimePackageSemaphore>$(PackagesDir)Test-Runtime-packages.config</TestRuntimePackageSemaphore> |
123 | | - </PropertyGroup> |
124 | | - |
125 | | - <Target Name="RestoreTestRuntimePackage" |
126 | | - BeforeTargets="ResolveNuGetPackages" |
127 | | - Inputs="$(TestRuntimePackageConfig)" |
128 | | - Outputs="$(TestRuntimePackageSemaphore)" |
129 | | - Condition="'$(IsTestProject)' == 'true'"> |
130 | | - <Exec Command="$(NugetRestoreCommand) "$(TestRuntimePackageConfig)"" StandardOutputImportance="Low" /> |
131 | | - <Copy SourceFiles="$(TestRuntimePackageConfig)" DestinationFiles="$(TestRuntimePackageSemaphore)" ContinueOnError="true" /> |
132 | | - </Target> |
133 | | - |
134 | | - <!-- Which categories of tests to run by default --> |
135 | | - <PropertyGroup> |
136 | | - <RunTestsWithCategories Condition="'$(RunTestsWithCategories)' == '' And '$(RunTestsWithoutCategories)' == ''">InnerLoop</RunTestsWithCategories> |
137 | | - <TestCategories Condition="'$(TestCategories)'==''">InnerLoop</TestCategories> |
138 | | - |
139 | | - <TestDisabled>False</TestDisabled> |
140 | | - <TestDisabled Condition="'$(IsTestProject)'!='True' Or '$(SkipTests)'=='True' Or '$(RunTestsForProject)'=='False'">True</TestDisabled> |
141 | | - </PropertyGroup> |
142 | | - |
143 | | - <ItemGroup> |
144 | | - <!-- Split semicolon separated lists --> |
145 | | - <TestCategoriesItems Include="$(TestCategories)" /> |
146 | | - <RunTestsWithCategoriesItems Include="$(RunTestsWithCategories)" /> |
147 | | - <RunTestsWithoutCategoriesItems Include="$(RunTestsWithoutCategories)" /> |
148 | | - </ItemGroup> |
149 | | - |
150 | | - <!-- General xunit options --> |
151 | | - <PropertyGroup> |
152 | | - <XunitCommandLine>xunit.console.netcore.exe $(TargetFileName)</XunitCommandLine> |
153 | | - <XunitOptions>$(XunitOptions) -xml .\testResults.xml</XunitOptions> |
154 | | - <XunitOptions>$(XunitOptions) -notrait category=failing</XunitOptions> |
155 | | - </PropertyGroup> |
156 | | - |
157 | | - <!-- Directory specific coverage options --> |
158 | | - <PropertyGroup> |
159 | | - <CoverageEnabledForProject Condition="'$(CoverageEnabledForProject)'=='' and '$(IsTestProject)'=='true'">$(_CoverageEnabled)</CoverageEnabledForProject> |
160 | | - <XunitHost>corerun.exe</XunitHost> |
161 | | - <CoverageHost>$(CoverageToolPath)</CoverageHost> |
162 | | - <CoverageOutputFilePath>$(CoverageReportDir)$(MSBuildProjectName).coverage.xml</CoverageOutputFilePath> |
163 | | - <CoverageOptions>-filter:"+[*]* -[*.Tests]*" -nodefaultfilters -excludebyattribute:*.ExcludeFromCodeCoverage* -skipautoprops -hideskipped:All -threshold:1</CoverageOptions> |
164 | | - <CoverageCommandLine>$(CoverageOptions) -returntargetcode -register:user -target:$(XunitHost) -output:$(CoverageOutputFilePath)</CoverageCommandLine> |
165 | | - </PropertyGroup> |
166 | | - |
167 | | - <!-- In VS (2015 Preview or later currently required): Debug to run unit tests on CoreCLR. --> |
168 | | - <PropertyGroup Condition="'$(IsTestProject)'=='True'"> |
169 | | - <DebugTestFrameworkFolder>aspnetcore50</DebugTestFrameworkFolder> |
170 | | - <StartWorkingDirectory Condition="'$(StartWorkingDirectory)' == ''">$(TestPath)$(DebugTestFrameworkFolder)</StartWorkingDirectory> |
171 | | - <StartAction Condition="'$(StartAction)' == ''">Program</StartAction> |
172 | | - <StartProgram Condition="'$(StartProgram)' == ''">$(StartWorkingDirectory)\$(TestHost)</StartProgram> |
173 | | - <StartArguments Condition="'$(StartArguments)' == ''">$(TestCommandLine) -wait</StartArguments> |
174 | | - <DebugEngines>{2E36F1D4-B23C-435D-AB41-18E608940038}</DebugEngines> |
175 | | - </PropertyGroup> |
176 | | - |
177 | | - <!-- On command line run unit tests on CoreCLR after the Test target --> |
178 | | - <Target Name="RunTestsForProject" |
179 | | - AfterTargets="CheckTestCategories" |
180 | | - Condition="'$(TestDisabled)'!='True'"> |
181 | | - |
182 | | - <PropertyGroup> |
183 | | - <XunitOptions Condition="'@(RunWithTraits)'!=''">$(XunitOptions) -trait category=@(RunWithTraits, ' -trait category=') </XunitOptions> |
184 | | - <XunitOptions Condition="'@(RunWithoutTraits)'!=''">$(XunitOptions) -notrait category=@(RunWithoutTraits, ' -notrait category=') </XunitOptions> |
185 | | - </PropertyGroup> |
186 | | - |
187 | | - <!-- xUnit command line without coverage enabled --> |
188 | | - <PropertyGroup> |
189 | | - <TestHost>$(XunitHost)</TestHost> |
190 | | - <TestCommandLine>$(XunitCommandLine) $(XunitOptions)</TestCommandLine> |
191 | | - </PropertyGroup> |
192 | | - |
193 | | - <!-- xUnit command line with coverage enabled --> |
194 | | - <PropertyGroup Condition="'$(CoverageEnabledForProject)'=='true'"> |
195 | | - <TestHost>$(CoverageHost)</TestHost> |
196 | | - <XunitOptions>$(XunitOptions) -parallel none</XunitOptions> |
197 | | - <TestCommandLine>$(CoverageCommandLine) -targetargs:"$(TestCommandLine)"</TestCommandLine> |
198 | | - </PropertyGroup> |
199 | | - |
200 | | - <MakeDir Condition="'$(CoverageEnabledForProject)'=='true'" Directories="$(CoverageReportDir)" /> |
201 | | - |
202 | | - <Exec Command="$(TestHost) $(TestCommandLine)" |
203 | | - WorkingDirectory="$(TestPath)%(TestTargetFramework.Folder)" |
204 | | - ContinueOnError="True"> |
205 | | - <Output PropertyName="TestRunExitCode" TaskParameter="ExitCode" /> |
206 | | - </Exec> |
207 | | - |
208 | | - <Error Condition="'$(TestRunExitCode)' != '0'" Text="One or more tests failed while running tests from '$(MSBuildProjectName)' please check log for details!" /> |
209 | | - </Target> |
210 | | - |
211 | | - <Target Name="CheckTestCategories" |
212 | | - AfterTargets="Test" |
213 | | - Condition="'$(TestDisabled)'!='True'"> |
214 | | - |
215 | | - <Error Condition="'$(RunTestsWithCategories)' != '' And '$(RunTestsWithoutCategories)' != ''" |
216 | | - Text="Specifying both RunTestsWithCategories and RunTestsWithoutCategories is not supported please only specify one or the other." /> |
217 | | - |
218 | | - <ItemGroup Condition="'@(RunTestsWithCategoriesItems)'!=''"> |
219 | | - <!-- Intersection of TestCategoriesItems and RunTestsWithCategoriesItems --> |
220 | | - <TestCategoriesToRun Include="@(TestCategoriesItems)" Condition="'@(RunTestsWithCategoriesItems)'=='%(Identity)'" /> |
221 | | - </ItemGroup> |
222 | | - <ItemGroup Condition="'@(RunTestsWithoutCategoriesItems)'!=''"> |
223 | | - <!-- Run all test categories except specified --> |
224 | | - <TestCategoriesToRun Include="@(TestCategoriesItems)" Exclude="@(RunTestsWithoutCategoriesItems)" /> |
225 | | - </ItemGroup> |
226 | | - <ItemGroup> |
227 | | - <RunWithInnerLoopItems Include="@(TestCategoriesToRun)" Condition="'%(TestCategoriesToRun.Identity)'=='InnerLoop'" /> |
228 | | - |
229 | | - <RunWithTraits Condition="'@(RunWithInnerLoopItems)'==''" Include="@(TestCategoriesToRun)" /> |
230 | | - |
231 | | - <RunWithoutTraits Condition="'@(RunWithInnerLoopItems)'!=''" Include="@(TestCategoriesItems)" /> |
232 | | - <RunWithoutTraits Condition="'@(RunWithInnerLoopItems)'!=''" Remove="@(TestCategoriesToRun)" /> |
233 | | - </ItemGroup> |
234 | | - <PropertyGroup> |
235 | | - <!-- If there is nothing to run then disable the test --> |
236 | | - <TestDisabled Condition="'@(TestCategoriesToRun)'==''">True</TestDisabled> |
237 | | - </PropertyGroup> |
238 | | - </Target> |
239 | | - |
240 | | - <!-- Generate coverage reports for individual projects. --> |
241 | | - <Target Name="GenerateIndividualCoverageReport" |
242 | | - AfterTargets="RunTestsForProject" |
243 | | - Inputs="$(CoverageOutputFilePath)" |
244 | | - Outputs="$(CoverageReportDir)index.htm" |
245 | | - Condition="'$(BuildAllProjects)'!='true' and '$(CoverageEnabledForProject)'=='true'"> |
246 | 7 |
|
247 | | - <Exec Command="$(CoverageReportGeneratorCommandLine) -reports:$(CoverageOutputFilePath)" |
248 | | - ContinueOnError="ErrorAndContinue" /> |
249 | | - </Target> |
| 8 | + <Import Project="$(ToolsDir)Build.Common.targets" Condition="Exists('$(ToolsDir)Build.Common.targets')" /> |
250 | 9 |
|
251 | 10 | </Project> |
0 commit comments