This file is indexed.

/usr/lib/mono/4.5/Microsoft.Common.targets is in mono-xbuild 4.6.2.7+dfsg-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfigurationAndPlatform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
		<ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
	</PropertyGroup>

	<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore\*"
		Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore')"/>

	<Import Project="$(MSBuildProjectFullPath).user" Condition="Exists('$(MSBuildProjectFullPath).user')"/>

	<PropertyGroup>
		<OutputType Condition="'$(OutputType)' == ''">Exe</OutputType>
		<TargetExt Condition="'$(OutputType)' == 'Winexe'">.exe</TargetExt>
		<TargetExt Condition="'$(OutputType)' == 'Exe'">.exe</TargetExt>
		<TargetExt Condition="'$(OutputType)' == 'Library'">.dll</TargetExt>
		<TargetExt Condition="'$(OutputType)' == 'Netmodule'">.netmodule</TargetExt>
	</PropertyGroup>

	<PropertyGroup>
		<ProjectDir Condition="'$(ProjectDir)' == ''">$(MSBuildProjectDirectory)\</ProjectDir>
	</PropertyGroup>

	<!-- MSBuild defines this even outside of VS, and F# projects depend on it -->
	<PropertyGroup>
		<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
	</PropertyGroup>

	<PropertyGroup>
		<AssemblyName Condition="'$(AssemblyName)' == ''">$(MSBuildProjectName)</AssemblyName>
		<OutputPath Condition="'$(OutputPath)' != '' and !HasTrailingSlash('$(OutputPath)')">$(OutputPath)\</OutputPath>
		<OutputPath Condition=" '$(Platform)'=='' and '$(Configuration)'=='' and '$(OutputPath)'=='' ">bin\Debug\</OutputPath>

		<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETFramework</TargetFrameworkIdentifier>
		<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5</TargetFrameworkVersion>

		<TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == '' and '$(TargetFrameworkProfile)' != ''">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile)</TargetFrameworkMoniker>
	        <TargetFrameworkMoniker Condition="'$(TargetFrameworkMoniker)' == ''">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker>
	</PropertyGroup>

	<PropertyGroup>
		<OutDir Condition="'$(OutDir)' == ''">$(OutputPath)</OutDir>
		<OutDir Condition="'$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')">$(OutDir)\</OutDir>

		<_OriginalConfiguration>$(Configuration)</_OriginalConfiguration>
		<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
		<ConfigurationName Condition="'$(ConfigurationName)' == ''">$(Configuration)</ConfigurationName>

		<_OriginalPlatform>$(Platform)</_OriginalPlatform>
		<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
		<PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
	</PropertyGroup>

	<!-- in MSBuild, these properties are set in a separate file that is only imported for .NETFramework -->
	<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
		<AddAdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == ''">true</AddAdditionalExplicitAssemblyReferences>
		<AdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == 'true' and '$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0'">System.Core;$(AdditionalExplicitAssemblyReferences)</AdditionalExplicitAssemblyReferences>
	</PropertyGroup>

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

	<PropertyGroup>
		<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">obj\</BaseIntermediateOutputPath>
		<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' != '' and !HasTrailingSlash('$(BaseIntermediateOutputPath)')">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
		<CleanFile Condition="'$(CleanFile)'==''">$(MSBuildProjectFile).FilesWrittenAbsolute.txt</CleanFile>
	</PropertyGroup>

	<PropertyGroup Condition="'$(IntermediateOutputPath)' == ''">
		<IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU'">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
		<IntermediateOutputPath Condition=" '$(PlatformName)' != 'AnyCPU'">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>
	</PropertyGroup>

	<PropertyGroup>
		<IntermediateOutputPath Condition="'$(IntermediateOutputPath)' != '' and !HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
	</PropertyGroup>

	<ItemGroup>
		<IntermediateAssembly Include="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt)" />

		<!-- creating this as a item to use FullPath on it, to build TargetPath -->
		<_OutDirItem Include="$(OutDir)"/>
	</ItemGroup>

	<PropertyGroup>
		<TargetName Condition="'$(TargetName)' == '' ">$(AssemblyName)</TargetName>
		<TargetFileName Condition="'$(TargetFileName)' == '' ">$(TargetName)$(TargetExt)</TargetFileName>
		<TargetDir Condition=" '$(TargetDir)' == '' ">@(_OutDirItem->'%(FullPath)')</TargetDir>
		<TargetPath Condition=" '$(TargetPath)' == '' ">@(_OutDirItem->'%(FullPath)\$(TargetFileName)')</TargetPath>
		<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildProjectFullPath);$(MSBuildToolsPath)\Microsoft.Common.targets</MSBuildAllProjects>
		<KeyOriginatorFile Condition=" '$(SignAssembly)' == 'true' ">$(AssemblyOriginatorKeyFile)</KeyOriginatorFile>
		<TargetingClr2Framework Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5')">true</TargetingClr2Framework>
	</PropertyGroup>

	<Target Name="_CheckForInvalidConfigurationAndPlatform">
		<Error Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' != 'true'"
			Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>

		<Warning Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' == 'true'"
			Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>

		<!-- If OutDir is specified via the command line, then the earlier check
		     to add a trailing slash won't have any affect, so error here. -->
		<Error
			Condition="'$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')"
			Text="OutDir property must end with a slash."/>
	</Target>

	<PropertyGroup>
		<PrepareForBuildDependsOn>AssignLinkMetadata</PrepareForBuildDependsOn>
	</PropertyGroup>
	<Target Name="PrepareForBuild" DependsOnTargets="$(PrepareForBuildDependsOn)">
		<Message Importance="High" Text="Configuration: $(Configuration) Platform: $(Platform)"/>

		<!-- Look for app.config, if $(AppConfig) is specified, then use that. Else look in
		     @(None) and @(Content) -->
		<CreateItem Include="$(AppConfig)" Condition="'$(AppConfig)' != ''"
			AdditionalMetadata="TargetPath=$(TargetFileName).config">
			<Output TaskParameter="Include" ItemName="AppConfigWithTargetPath" />
		</CreateItem>

		<FindAppConfigFile PrimaryList="@(None)" SecondaryList="@(Content)" TargetPath="$(TargetFileName).config"
			Condition="'$(AppConfig)' == ''">
			<Output TaskParameter="AppConfigFile" ItemName="AppConfigWithTargetPath"/>
		</FindAppConfigFile>

		<MakeDir
			Directories="$(OutDir);$(IntermediateOutputPath);@(DocFileItem->'%(RelativeDir)')"
		/>
	</Target>

	<Target Name="AssignLinkMetadata">
	    <AssignLinkMetadata Items="@(EmbeddedResource)" Condition="'@(EmbeddedResource)' != '' and '%(EmbeddedResource.DefiningProjectFullPath)' != '$(MSBuildProjectFullPath)'">
	      <Output TaskParameter="OutputItems" ItemName="_EmbeddedResourceWithLinkAssigned" />
	    </AssignLinkMetadata>

	    <ItemGroup>
			<EmbeddedResource Remove="@(_EmbeddedResourceWithLinkAssigned)" />
			<EmbeddedResource Include="@(_EmbeddedResourceWithLinkAssigned)" />
			<_EmbeddedResourceWithLinkAssigned Remove="@(_EmbeddedResourceWithLinkAssigned)" />
	    </ItemGroup>
	</Target>

	<PropertyGroup>
		<GetFrameworkPathsDependsOn />
	</PropertyGroup>
	<Target Name="GetFrameworkPaths"
		Condition="'$(TargetFrameworkIdentifier)' == '' or '$(TargetFrameworkIdentifier)' == '.NETFramework'"
		DependsOnTargets="$(GetFrameworkPathsDependsOn)">
		<GetFrameworkPath>
			<Output Condition="'$(TargetFrameworkVersion)' == 'v4.5'"
				TaskParameter="FrameworkVersion45Path"
				ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
			<Output Condition="'$(TargetFrameworkVersion)' == 'v4.0'"
				TaskParameter="FrameworkVersion40Path"
				ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
			<Output Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
				TaskParameter="FrameworkVersion35Path"
				ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
			<Output Condition="'$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'"
				TaskParameter="FrameworkVersion30Path"
				ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
			<Output Condition="'$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5'"
				TaskParameter="FrameworkVersion20Path"
				ItemName="_CombinedTargetFrameworkDirectoriesItem"/>
		</GetFrameworkPath>
		<CreateProperty Value="@(_CombinedTargetFrameworkDirectoriesItem)">
			<Output TaskParameter="Value" PropertyName="TargetFrameworkDirectory"/>
		</CreateProperty>

		<Warning Text="TargetFrameworkVersion '$(TargetFrameworkVersion)' not supported by this toolset (ToolsVersion: $(MSBuildToolsVersion))."
			Condition="'$(TargetFrameworkVersion)' != 'v4.5' and '$(TargetFrameworkVersion)' != 'v4.0' and '$(TargetFrameworkVersion)' != 'v3.5' and '$(TargetFrameworkVersion)' != 'v3.0' and '$(TargetFrameworkVersion)' != 'v2.0'"/>
	</Target>

	<PropertyGroup>
		<GetReferenceAssemblyPathsDependsOn />
	</PropertyGroup>
	<Target Name="GetReferenceAssemblyPaths" DependsOnTargets="$(GetReferenceAssemblyPathsDependsOn)">
		<!-- in case of .NETFramework, $(TargetFrameworkDirectory) would have been set by
		GetFrameworkPaths, if it hasn't been changed, then clear it, to avoid duplicates -->
		<CreateProperty Value="" Condition="'@(_CombinedTargetFrameworkDirectoriesItem)' == '$(TargetFrameworkDirectory)'">
			<Output TaskParameter="Value" PropertyName="TargetFrameworkDirectory"/>
		</CreateProperty>

		<GetReferenceAssemblyPaths
			Condition="'$(TargetFrameworkMoniker)' != '' and '$(_TargetFrameworkDirectories)' == ''"
			TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
			RootPath="$(TargetFrameworkRootPath)">

			<Output TaskParameter="ReferenceAssemblyPaths" PropertyName="_TargetFrameworkDirectories"/>
			<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="_FullFrameworkReferenceAssemblyPaths"/>
			<Output TaskParameter="TargetFrameworkMonikerDisplayName" PropertyName="TargetFrameworkMonikerDisplayName"/>
		</GetReferenceAssemblyPaths>


		<!-- Remove duplicates. -->
		<ItemGroup>
			<_TargetFrameworkDirectories Include="$(_TargetFrameworkDirectories);$(TargetFrameworkDirectory)" KeepDuplicates="false" />
		</ItemGroup>
		<PropertyGroup>
			<TargetFrameworkDirectory>@(_TargetFrameworkDirectories)</TargetFrameworkDirectory>
		</PropertyGroup>

		<ItemGroup Condition="'$(ImplicitlyExpandDesignTimeFacades)' == 'true'">
			<DesignTimeFacadeDirectoryRoots Include="$(TargetFrameworkDirectory)" />
			<DesignTimeFacadeDirectories Include="%(DesignTimeFacadeDirectoryRoots.Identity)\Facades\" Condition="Exists('%(DesignTimeFacadeDirectoryRoots.Identity)\Facades\')" />
			<_DesignTimeFacadeAssemblies Include="%(DesignTimeFacadeDirectories.Identity)\*.dll"/>
		</ItemGroup>

		<PropertyGroup Condition="'@(DesignTimeFacadeDirectories)' != ''">
			<TargetFrameworkDirectory>$(TargetFrameworkDirectory);@(DesignTimeFacadeDirectories)</TargetFrameworkDirectory>
		</PropertyGroup>

	</Target>

	<PropertyGroup>
		<AllowedReferenceAssemblyFileExtensions Condition=" '$(AllowedReferenceAssemblyFileExtensions)' == '' ">
			.exe;
			.dll
		</AllowedReferenceAssemblyFileExtensions>

		<AllowedReferenceRelatedFileExtensions Condition=" '$(AllowedReferenceRelatedFileExtensions)' == '' ">
			.exe.mdb;
			.dll.mdb;
			.pdb;
			.xml
		</AllowedReferenceRelatedFileExtensions>

		<AssemblySearchPaths Condition="'$(AssemblySearchPaths)' == ''">
			{CandidateAssemblyFiles};
			$(ReferencePath);
			@(AdditionalReferencePath);
			{HintPathFromItem};
			{TargetFrameworkDirectory};
			{PkgConfig};
			{GAC};
			{RawFileName};
			$(OutDir)
		</AssemblySearchPaths>

		<ResolveReferencesDependsOn>
			BeforeResolveReferences;
			ResolveProjectReferences;
			ResolveAssemblyReferences;
			AfterResolveReferences
		</ResolveReferencesDependsOn>

		<ResolveAssemblyReferencesDependsOn>
			GetFrameworkPaths;
			GetReferenceAssemblyPaths;
			PrepareForBuild
		</ResolveAssemblyReferencesDependsOn>
	</PropertyGroup>

	<PropertyGroup Condition="'$(TargetFrameworkMoniker)' != ''">
		<TargetFrameworkMonikerAssemblyAttributesPath Condition="'$(TargetFrameworkMonikerAssemblyAttributesPath)' == ''">$(IntermediateOutputPath)$(TargetFrameworkMoniker).AssemblyAttribute$(DefaultLanguageSourceExtension)</TargetFrameworkMonikerAssemblyAttributesPath>
		<GenerateTargetFrameworkAttribute Condition="'$(GenerateTargetFrameworkAttribute)' == '' and '$(TargetFrameworkMoniker)'
	!= '' and '$(TargetingClr2Framework)' != 'true'">true</GenerateTargetFrameworkAttribute>
	</PropertyGroup>

	<ItemGroup Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
		<FileWrites Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
	</ItemGroup>

	<Target Name="_GenerateTargetFrameworkMonikerAttribute"
		DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
		Inputs="$(MSBuildToolsPath)\Microsoft.Common.targets"
		Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)">

		<WriteLinesToFile
			File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
			Lines="$(TargetFrameworkMonikerAssemblyAttributeText)"
			Overwrite="true"
			ContinueOnError="true"
			Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''"
		/>
	</Target>

	<Target Name="GenerateTargetFrameworkMonikerAttribute"
		DependsOnTargets="_GenerateTargetFrameworkMonikerAttribute"
		Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">

		<ItemGroup Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''">
			<Compile Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/>
		</ItemGroup>
	</Target>

	<Target Name="ResolveReferences" DependsOnTargets="$(ResolveReferencesDependsOn)"/>

	<Target Name="BeforeResolveReferences" />
	<Target Name="AfterResolveReferences" />

	<Target Name="ResolveAssemblyReferences" DependsOnTargets="$(ResolveAssemblyReferencesDependsOn)">
		<CreateItem Include="@(Reference)" Exclude="$(AdditionalExplicitAssemblyReferences)">
			<Output TaskParameter="Include" ItemName="_Reference"/>
		</CreateItem>

		<CreateItem Include="$(AdditionalExplicitAssemblyReferences)">
			<Output TaskParameter="Include" ItemName="_Reference"/>
		</CreateItem>

		<ResolveAssemblyReference
			Assemblies="@(_Reference)"
			AssemblyFiles="@(ChildProjectReferences);@(_ExplicitReference)"
			SearchPaths="$(AssemblySearchPaths)"
			CandidateAssemblyFiles="@(Content);@(None)"
			TargetFrameworkDirectories="$(TargetFrameworkDirectory)"
			AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
			AllowedRelatedFileExtensions="$(AllowedReferenceRelatedFileExtensions)"
			FindDependencies="true"
			FindSatellites="true"
			FindRelatedFiles="true"
			TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
			TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
			TargetFrameworkVersion="$(TargetFrameworkVersion)"
		>
			<Output TaskParameter="ResolvedFiles" ItemName="ResolvedFiles"/>
			<Output TaskParameter="ResolvedFiles" ItemName="ReferencePath"/>
			<Output TaskParameter="ResolvedDependencyFiles" ItemName="ReferenceDependencyPaths"/>
			<Output TaskParameter="RelatedFiles" ItemName="_ReferenceRelatedPaths"/>
			<Output TaskParameter="SatelliteFiles" ItemName="ReferenceSatellitePaths"/>
			<Output TaskParameter="CopyLocalFiles" ItemName="ReferenceCopyLocalPaths"/>

			<!-- FIXME: backwards compatibility -->
			<Output TaskParameter="ResolvedDependencyFiles" ItemName="_ResolvedDependencyFiles"/>
		</ResolveAssemblyReference>
	</Target>

	<Target
		Name="AssignProjectConfiguration"
		Condition="'@(ProjectReference)' != ''">

		<!-- assign configs if building a solution file -->
		<AssignProjectConfiguration
			ProjectReferences = "@(ProjectReference)"
			SolutionConfigurationContents = "$(CurrentSolutionConfigurationContents)"
			Condition="$(CurrentSolutionConfigurationContents) != '' and ('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true')">

			<Output TaskParameter = "AssignedProjects" ItemName = "ProjectReferenceWithConfiguration"/>
		</AssignProjectConfiguration>

		<!-- Else, just -->
		<CreateItem Include="@(ProjectReference)" Condition="$(CurrentSolutionConfigurationContents) == '' or ('$(BuildingSolutionFile)' != 'true' and '$(BuildingInsideVisualStudio)' != 'true')">
			<Output TaskParameter="Include" ItemName="ProjectReferenceWithConfiguration"/>
		</CreateItem>

	</Target>

	<!-- Split projects into 2 lists
		ProjectReferenceWithConfigurationExistent: Projects existent on disk
		ProjectReferenceWithConfigurationNonExistent: Projects non-existent on disk -->

	<Target Name="SplitProjectReferencesByExistent"
		DependsOnTargets="AssignProjectConfiguration">

		<CreateItem Include="@(ProjectReferenceWithConfiguration)" Condition="'@(ProjectReferenceWithConfiguration)' != ''">
			<Output TaskParameter="Include" ItemName="ProjectReferenceWithConfigurationExistent"
				Condition="Exists ('%(ProjectReferenceWithConfiguration.Identity)')"/>

			<Output TaskParameter="Include" ItemName="ProjectReferenceWithConfigurationNonExistent"
				Condition="!Exists ('%(ProjectReferenceWithConfiguration.Identity)')"/>
		</CreateItem>
	</Target>

	<Target
		Name="ResolveProjectReferences"
		DependsOnTargets="SplitProjectReferencesByExistent"
	>
		<!-- If building from a .sln.proj or from IDE, then referenced projects have already
		     been built, so just get the target paths -->
		<MSBuild
			Projects="@(ProjectReferenceWithConfigurationExistent)"
			Targets="GetTargetPath"
			Properties="%(ProjectReferenceWithConfigurationExistent.SetConfiguration); %(ProjectReferenceWithConfigurationExistent.SetPlatform)"
			Condition="'@(ProjectReferenceWithConfigurationExistent)' != '' and ('$(BuildingSolutionFile)' == 'true' or '$(BuildingInsideVisualStudio)' == 'true')">

			<Output TaskParameter="TargetOutputs" ItemName="ChildProjectReferences" Condition="'%(ProjectReferenceWithConfigurationExistent.ReferenceOutputAssembly)' != 'false'"/>
		</MSBuild>

		<!-- Building a project directly, build the referenced the projects also -->
		<MSBuild
			Projects="@(ProjectReferenceWithConfigurationExistent)"
			Properties="%(ProjectReferenceWithConfigurationExistent.SetConfiguration); %(ProjectReferenceWithConfigurationExistent.SetPlatform)"
			Condition="'@(ProjectReferenceWithConfigurationExistent)' != '' and '$(BuildingSolutionFile)' != 'true' and '$(BuildingInsideVisualStudio)' != 'true' ">

			<Output TaskParameter="TargetOutputs" ItemName="ChildProjectReferences" Condition="'%(ProjectReferenceWithConfigurationExistent.ReferenceOutputAssembly)' != 'false'"/>
		</MSBuild>

		<Warning Text="Referenced Project %(ProjectReferenceWithConfigurationNonExistent.Identity) not found, ignoring."
			 Condition="'@(ProjectReferenceWithConfigurationNonExistent)' != ''"/>
	</Target>

	<Target Name = "CopyFilesMarkedCopyLocal">
		<Copy
			SourceFiles="@(ReferenceCopyLocalPaths)"
			DestinationFiles="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')"
			SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
			<Output TaskParameter = "DestinationFiles" ItemName = "FileWritesShareable"/>
		</Copy>
	</Target>

	<Target Name="_ComputeNonExistentFileProperty" Condition='false'>
		<CreateProperty Value="__NonExistentSubDir__\__NonExistentFile__">
			<Output TaskParameter="Value" PropertyName="NonExistentFile"/>
		</CreateProperty>
	</Target>

	<PropertyGroup>
		<BuildDependsOn>
			BuildOnlySettings;
			BeforeBuild;
			CoreBuild;
			AfterBuild
		</BuildDependsOn>
	</PropertyGroup>

	<Target Name="BuildOnlySettings"/>
	<Target Name="BeforeBuild"/>
	<Target Name="AfterBuild"/>

	<Target Name="Build" DependsOnTargets="$(BuildDependsOn)" Outputs="$(TargetPath)"/>

	<PropertyGroup>
		<CoreBuildDependsOn>
			PrepareForBuild;
			GetFrameworkPaths;
			GetReferenceAssemblyPaths;
			PreBuildEvent;
			ResolveReferences;
			CopyFilesMarkedCopyLocal;
			PrepareResources;
			Compile;
			PrepareForRun;
			DeployOutputFiles;
			_RecordCleanFile;
			PostBuildEvent
		</CoreBuildDependsOn>
	</PropertyGroup>

	<Target
		Name="CoreBuild"
		DependsOnTargets="$(CoreBuildDependsOn)"
		Outputs="$(OutDir)$(AssemblyName)$(TargetExt)">

		<OnError ExecuteTargets="_TimestampAfterCompile;PostBuildEvent"
			Condition=" '$(RunPostBuildEvent)' == 'Always' or '$(RunPostBuildEvent)' == 'OnOutputUpdated'"/>

		<OnError ExecuteTargets="_RecordCleanFile" />
	</Target>

	<PropertyGroup>
		<CompileDependsOn>
			ResolveReferences;
			GenerateTargetFrameworkMonikerAttribute;
			BeforeCompile;
			_TimestampBeforeCompile;
			CoreCompile;
			_TimestampAfterCompile;
			AfterCompile
		</CompileDependsOn>
	</PropertyGroup>

	<Target Name="BeforeCompile" />
	<Target Name="AfterCompile" />

	<Target Name="Compile" DependsOnTargets="$(CompileDependsOn)"/>

	<PropertyGroup>
		<PrepareForRunDependsOn>
			DeployOutputFiles
		</PrepareForRunDependsOn>
	</PropertyGroup>
	<Target Name="PrepareForRun" DependsOnTargets="$(PrepareForRunDependsOn)"/>

	<PropertyGroup>
		<PrepareResourcesDependsOn>
			AssignTargetPaths;
			SplitResourcesByCulture;
			CreateManifestResourceNames;
			CopyNonResxEmbeddedResources;
			GenerateResources;
			GenerateSatelliteAssemblies;
			CompileLicxFiles
		</PrepareResourcesDependsOn>
	</PropertyGroup>
	<Target Name="PrepareResources" DependsOnTargets="$(PrepareResourcesDependsOn)" />

	<Target Name="SplitResourcesByCulture" DependsOnTargets="AssignTargetPaths">
		<!-- Extract .licx files into @(LicxFiles) -->
		<CreateItem Include="@(EmbeddedResourceWithTargetPath)" Condition="'%(Extension)' == '.licx'">
			<Output TaskParameter="Include" ItemName="LicxFiles"/>
		</CreateItem>

		<!-- Split *remaining* resource files into various groups.. -->
		<AssignCulture Files="@(EmbeddedResourceWithTargetPath)" Condition="'%(Extension)' != '.licx'">
			<Output TaskParameter="AssignedFilesWithNoCulture" ItemName="ResourcesWithNoCulture"/>
			<Output TaskParameter="AssignedFilesWithCulture" ItemName="ResourcesWithCulture"/>
		</AssignCulture>

		<CreateItem Include="@(ResourcesWithNoCulture)" Condition="'%(Extension)' == '.resx'">
			<Output TaskParameter="Include" ItemName="ResxWithNoCulture"/>
		</CreateItem>

		<CreateItem Include="@(ResourcesWithNoCulture)" Condition="'%(Extension)' != '.resx'">
			<Output TaskParameter="Include" ItemName="NonResxWithNoCulture"/>
		</CreateItem>

		<CreateItem Include="@(ResourcesWithCulture)" Condition="'%(Extension)' == '.resx'">
			<Output TaskParameter="Include" ItemName="ResxWithCulture"/>
		</CreateItem>

		<CreateItem Include="@(ResourcesWithCulture)" Condition="'%(Extension)' != '.resx'">
			<Output TaskParameter="Include" ItemName="NonResxWithCulture"/>
		</CreateItem>
	</Target>

	<!-- Copy non-resx resources to their manifest resource names, this is what the compiler expects -->
	<Target Name = "CopyNonResxEmbeddedResources"
		Condition = "'@(NonResxWithCulture)' != '' or '@(NonResxWithNoCulture)' != '' or '@(ManifestNonResxWithCulture)' != '' or '@(ManifestNonResxWithNoCulture)' != ''">

		<MakeDir Directories="$(IntermediateOutputPath)%(ManifestNonResxWithCulture.Culture)"/>
		<Copy SourceFiles = "@(NonResxWithCulture)"
			DestinationFiles = "@(ManifestNonResxWithCulture->'$(IntermediateOutputPath)%(Identity)')"
			SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
			<Output TaskParameter = "DestinationFiles" ItemName = "ManifestNonResxWithCultureOnDisk"/>
			<Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
		</Copy>

		<Copy SourceFiles = "@(NonResxWithNoCulture)"
			DestinationFiles = "@(ManifestNonResxWithNoCulture->'$(IntermediateOutputPath)%(Identity)')"
			SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
			<Output TaskParameter = "DestinationFiles" ItemName = "ManifestNonResxWithNoCultureOnDisk"/>
			<Output TaskParameter = "DestinationFiles" ItemName = "FileWrites"/>
		</Copy>
	</Target>

	<Target Name = "GenerateResources">
		<GenerateResource
			Sources = "@(ResxWithNoCulture)"
			UseSourcePath = "true"
			OutputResources = "@(ManifestResourceWithNoCultureName->'$(IntermediateOutputPath)%(Identity).resources')"
			Condition = "'@(ResxWithNoCulture)' != '' ">

			<Output TaskParameter = "OutputResources" ItemName = "ManifestResourceWithNoCulture"/>
			<Output TaskParameter = "FilesWritten" ItemName = "FileWrites"/>
		</GenerateResource>

		<GenerateResource
			Sources = "@(ResxWithCulture)"
			UseSourcePath = "true"
			OutputResources = "@(ManifestResourceWithCultureName->'$(IntermediateOutputPath)%(Identity).resources')"
			Condition = "'@(ResxWithCulture)' != '' ">

			<Output TaskParameter = "OutputResources" ItemName = "ManifestResourceWithCulture"/>
			<Output TaskParameter = "FilesWritten" ItemName = "FileWrites"/>
		</GenerateResource>
	</Target>

	<Target Name="GenerateSatelliteAssemblies"
		Inputs="@(ManifestResourceWithCulture);@(ManifestNonResxWithCultureOnDisk)"
		Outputs="$(IntermediateOutputPath)%(Culture)\$(AssemblyName).resources.dll" >
		<!-- @(NonResxWithCulture) - rename files to ManifestNon.. and then use for AL -->
		<MakeDir Directories = "$(IntermediateOutputPath)%(ManifestResourceWithCulture.Culture)" Condition = "'@(ManifestResourceWithCulture)' != ''" />
		<MakeDir Directories = "$(IntermediateOutputPath)%(ManifestNonResxWithCultureOnDisk.Culture)" Condition = "'@(ManifestNonResxWithCultureOnDisk)' != ''" />

		<AL
			Culture = "%(Culture)"
			DelaySign="$(DelaySign)"
			EmbedResources = "@(ManifestResourceWithCulture);@(ManifestNonResxWithCultureOnDisk)"
			KeyFile="$(KeyOriginatorFile)"
			ToolExe="$(AlToolExe)"
			ToolPath="$(AlToolPath)"
			OutputAssembly = "$(IntermediateOutputPath)%(Culture)\$(AssemblyName).resources.dll" >
			<Output TaskParameter="OutputAssembly" ItemName="FileWrites"/>
		</AL>


		<CreateItem
			Include = "$(IntermediateOutputPath)%(Culture)\$(AssemblyName).resources.dll"
			AdditionalMetadata = "Culture=%(Culture)"
			Condition = "'@(ManifestResourceWithCulture)' != '' or '@(ManifestNonResxWithCultureOnDisk)' != ''">
			<Output TaskParameter = "Include" ItemName = "IntermediateSatelliteAssemblies" />
		</CreateItem>
	</Target>

	<PropertyGroup>
		<CompileLicxFilesDependsOn></CompileLicxFilesDependsOn>
	</PropertyGroup>

	<Target Name = "CompileLicxFiles"
		Condition = "'@(LicxFiles)' != ''"
		DependsOnTargets = "$(CompileLicxFilesDependsOn)"
		Outputs = "$(IntermediateOutputPath)$(TargetFileName).licenses">
		<LC
			Sources = "@(LicxFiles)"
			LicenseTarget = "$(TargetFileName)"
			OutputDirectory = "$(IntermediateOutputPath)"
			OutputLicense = "$(IntermediateOutputPath)$(TargetFileName).licenses"
			ReferencedAssemblies = "@(ReferencePath);@(ReferenceDependencyPaths)"
			ToolPath = "$(LCToolPath)"
			ToolExe = "$(LCToolExe)">

			<Output TaskParameter="OutputLicense" ItemName="CompiledLicenseFile"/>
			<Output TaskParameter="OutputLicense" ItemName="FileWrites"/>
		</LC>
	</Target>

	<!-- Assign target paths to files that will need to be copied along with the project -->
	<Target Name = "AssignTargetPaths">
		<AssignTargetPath Files="@(None)" RootFolder="$(MSBuildProjectDirectory)">
			<Output TaskParameter="AssignedFiles" ItemName="NoneWithTargetPath"/>
		</AssignTargetPath>

		<AssignTargetPath Files="@(Content)" RootFolder="$(MSBuildProjectDirectory)">
			<Output TaskParameter="AssignedFiles" ItemName="ContentWithTargetPath"/>
		</AssignTargetPath>

		<AssignTargetPath Files="@(EmbeddedResource)" RootFolder="$(MSBuildProjectDirectory)">
			<Output TaskParameter="AssignedFiles" ItemName="EmbeddedResourceWithTargetPath"/>
		</AssignTargetPath>
	</Target>

	<Target Name="DeployOutputFiles"
		DependsOnTargets="PrepareResources;CoreCompile;_CopyDeployFilesToOutputDirectory;_CopyAppConfigFile">

		<Copy
			SourceFiles="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb"
			Condition="'$(OutDir)' != '' and Exists('$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb')"
			DestinationFolder="$(OutDir)"
			SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" >
			<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
		</Copy>

		<Copy
			SourceFiles="$(IntermediateOutputPath)$(AssemblyName).pdb"
			Condition="'$(OutDir)' != '' and Exists('$(IntermediateOutputPath)$(AssemblyName).pdb')"
			DestinationFolder="$(OutDir)"
			SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" >
			<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
		</Copy>

		<Copy SourceFiles="@(IntermediateAssembly)" Condition="'$(OutDir)' != '' and Exists ('@(IntermediateAssembly)')" DestinationFolder="$(OutDir)" SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
			<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
		</Copy>

		<Copy
			SourceFiles = "@(IntermediateSatelliteAssemblies)"
			DestinationFiles = "@(IntermediateSatelliteAssemblies->'$(OutDir)\%(Culture)\$(AssemblyName).resources.dll')"
			Condition = "'@(IntermediateSatelliteAssemblies)' != ''"
			SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
			<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
		</Copy>
	</Target>

	<Target Name="_CopyDeployFilesToOutputDirectory"
		DependsOnTargets="GetCopyToOutputDirectoryItems;
			_CopyDeployFilesToOutputDirectoryAlways;
			_CopyDeployFilesToOutputDirectoryPreserveNewest"/>

	<Target Name="_CopyDeployFilesToOutputDirectoryPreserveNewest"
		Condition="'@(ItemsToCopyToOutputDirectoryPreserveNewest)' != ''"
		Inputs="@(ItemsToCopyToOutputDirectoryPreserveNewest)"
		Outputs="@(ItemsToCopyToOutputDirectoryPreserveNewest->'$(OutDir)%(TargetPath)')">

		<Copy SourceFiles="@(ItemsToCopyToOutputDirectoryPreserveNewest)"
			DestinationFiles="@(ItemsToCopyToOutputDirectoryPreserveNewest->'$(OutDir)%(TargetPath)')"
			SkipUnchangedFiles="$(SkipCopyUnchangedFiles)">
			<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
		</Copy>
	</Target>

	<!-- Copy if newer -->
	<Target Name="_CopyDeployFilesToOutputDirectoryAlways"
		Condition="'@(ItemsToCopyToOutputDirectoryAlways)' != ''">

		<Copy SourceFiles="@(ItemsToCopyToOutputDirectoryAlways)"
			DestinationFiles="@(ItemsToCopyToOutputDirectoryAlways->'$(OutDir)%(TargetPath)')">
			<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
		</Copy>
	</Target>


	<Target Name="_CopyAppConfigFile" Condition="'@(AppConfigWithTargetPath)' != ''"
		Inputs="@(AppConfigWithTargetPath)"
		Outputs="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')">

		<Copy SourceFiles="@(AppConfigWithTargetPath)"
			DestinationFiles="@(AppConfigWithTargetPath->'$(OutDir)%(TargetPath)')">
			<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
		</Copy>
	</Target>

	<Target Name="GetTargetPath" Outputs="$(TargetPath)"/>

	<Target Name="GetCopyToOutputDirectoryItems"
		Outputs="@(AllItemsFullPathWithTargetPath)"
		DependsOnTargets="AssignTargetPaths;SplitProjectReferencesByExistent">

		<!-- FIXME: handle .vcproj
		     FIXME: Private ProjectReferences are honored only in 3.5
		-->
		<MSBuild
			Projects="@(ProjectReferenceWithConfigurationExistent)"
			Targets="GetCopyToOutputDirectoryItems"
			Condition="'@(ProjectReferenceWithConfigurationExistent)' != '' and '%(ProjectReferenceWithConfigurationExistent.Private)' != 'false'">

			<Output TaskParameter="TargetOutputs" ItemName="AllChildProjectItemsWithTargetPath"/>
		</MSBuild>

		<!-- Process items from child project. The outputs need to have full path
		     as they'll be used from other projects -->

		<CreateItem
			Include="@(AllChildProjectItemsWithTargetPath->'%(FullPath)')"
			Condition="'%(AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)' == 'Always' or '%(AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)' == 'PreserveNewest'">

			<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryAlways"
				Condition="'%(AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryPreserveNewest"
				Condition="'%(AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>

		</CreateItem>

		<!-- Process _this_ project's items -->

		<CreateItem
			Include="@(NoneWithTargetPath->'%(FullPath)')"
			Condition="'%(NoneWithTargetPath.CopyToOutputDirectory)' == 'Always' or '%(NoneWithTargetPath.CopyToOutputDirectory)' == 'PreserveNewest'">
			<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryAlways"
				Condition="'%(NoneWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryPreserveNewest"
				Condition="'%(NoneWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
		</CreateItem>

		<CreateItem
			Include="@(ContentWithTargetPath->'%(FullPath)')"
			Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)' == 'Always' or '%(ContentWithTargetPath.CopyToOutputDirectory)' == 'PreserveNewest'">
			<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryAlways"
				Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryPreserveNewest"
				Condition="'%(ContentWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
		</CreateItem>

		<CreateItem
			Include="@(EmbeddedResourceWithTargetPath->'%(FullPath)')"
			Condition="'%(EmbeddedResourceWithTargetPath.CopyToOutputDirectory)' == 'Always' or '%(EmbeddedResourceWithTargetPath.CopyToOutputDirectory)' == 'PreserveNewest'">
			<Output TaskParameter="Include" ItemName="AllItemsFullPathWithTargetPath"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryAlways"
				Condition="'%(EmbeddedResourceWithTargetPath.CopyToOutputDirectory)'=='Always'"/>
			<Output TaskParameter="Include" ItemName="ItemsToCopyToOutputDirectoryPreserveNewest"
				Condition="'%(EmbeddedResourceWithTargetPath.CopyToOutputDirectory)'=='PreserveNewest'"/>
		</CreateItem>

	</Target>

	<!-- Pre/Post BuildEvents -->
	<PropertyGroup>
		<PreBuildEventDependsOn />
	</PropertyGroup>

	<Target Name="PreBuildEvent"
		Condition="'$(PreBuildEvent)' != ''"
		DependsOnTargets="$(PreBuildEventDependsOn)">

		<Exec WorkingDirectory="$(OutDir)" Command="$(PreBuildEvent)" />
	</Target>

	<!-- PostBuildEvent depends on $(RunPostBuildEvent)

		Default: OnBuildSuccess
		OnBuildSuccess: Run after a successful build
		OnOutputUpdated: Run only if the output assembly got updates
		Always: Run always
	-->
	<PropertyGroup>
		<PostBuildEventDependsOn />
	</PropertyGroup>

	<!-- this gets invoked in two cases, from CoreBuildDependsOn, if the build completes
	     successfully, OR from OnError in CoreBuild, if the build failed and $(RunPostBuildEvent)
	     is 'Always' or 'OnOutputUpdated'. Invoke $(PostBuildEvent) if its either Empty (== OnBuildSuccess)
	     or OnBuildSuccess or Always OR (OnOutputUpdated and output assembly got updated) -->
	<Target Name="PostBuildEvent"
		Condition="'$(PostBuildEvent)' != '' and
			('$(RunPostBuildEvent)' != 'OnOutputUpdated' or
			  '$(_AssemblyModifiedTimeBeforeCompile)' != '$(_AssemblyModifiedTimeAfterCompile)')"
		DependsOnTargets="$(PostBuildEventDependsOn)">

		<Exec WorkingDirectory="$(OutDir)" Command="$(PostBuildEvent)" />
	</Target>

	<!-- Timestamp the output assemblies, required for PostBuildEvent -->
	<Target Name="_TimestampBeforeCompile" Condition="'$(RunPostBuildEvent)' == 'OnOutputUpdated'">
		<CreateItem Include="%(IntermediateAssembly.ModifiedTime)">
			<Output TaskParameter="Include" PropertyName="_AssemblyModifiedTimeBeforeCompile" />
		</CreateItem>
	</Target>
	<Target Name="_TimestampAfterCompile" Condition="'$(RunPostBuildEvent)' == 'OnOutputUpdated'">
		<CreateItem Include="%(IntermediateAssembly.ModifiedTime)">
			<Output TaskParameter="Include" PropertyName="_AssemblyModifiedTimeAfterCompile" />
		</CreateItem>
	</Target>

	<!-- Rebuild -->
	<PropertyGroup>
		<RebuildDependsOn>
			BeforeRebuild;
			Clean;
			$(MSBuildProjectDefaultTargets);
			AfterRebuild;
		</RebuildDependsOn>

		<RebuildDependsOn Condition="'$(MSBuildProjectDefaultTargets)' == 'Rebuild'">
			BeforeRebuild;
			Clean;
			Build;
			AfterRebuild;
		</RebuildDependsOn>
	</PropertyGroup>

	<Target Name="BeforeRebuild" />
	<Target Name="AfterRebuild" />

	<Target Name="Rebuild"
		DependsOnTargets="$(RebuildDependsOn)"
		Outputs="$(TargetPath)"/>

	<!-- Clean -->
	<Target Name="_RecordCleanFile"
		DependsOnTargets="_GetCompileOutputsForClean">

		<!-- add to list of previous writes for this platform/config -->

		<ReadLinesFromFile File="$(IntermediateOutputPath)$(CleanFile)">
			<Output TaskParameter="Lines" ItemName="PreviousFileWrites"/>
		</ReadLinesFromFile>

		<!-- CopyLocal files: In case all the projects build to common output
		     directory, then other projects might depend on some of these
		     CopyLocal files, so delete only the ones under *this* project
		     directory -->
		<FindUnderPath Path="$(MSBuildProjectDirectory)" Files="@(FileWritesShareable)">
			<Output TaskParameter="InPath" ItemName="FileWrites"/>
		</FindUnderPath>

		<RemoveDuplicates Inputs="@(PreviousFileWrites);@(FileWrites->'%(FullPath)')">
			<Output TaskParameter="Filtered" ItemName="CombinedFileWrites"/>
		</RemoveDuplicates>

		<WriteLinesToFile
			File="$(IntermediateOutputPath)$(CleanFile)"
			Lines="@(CombinedFileWrites)"
			Overwrite="true"/>
	</Target>

	<PropertyGroup>
		<CleanDependsOn>
			BeforeClean;
			CleanReferencedProjects;
			CoreClean;
			AfterClean
		</CleanDependsOn>
	</PropertyGroup>

	<Target Name="_GetCompileOutputsForClean">
		<!-- assembly and debug file in the *intermediate output path* -->
		<CreateItem Include="@(IntermediateAssembly)" Condition="Exists('@(IntermediateAssembly)')">
			<Output TaskParameter="Include" ItemName="FileWrites"/>
		</CreateItem>

		<CreateItem Include="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb"
			Condition="Exists('$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb')">
			<Output TaskParameter="Include" ItemName="FileWrites"/>
		</CreateItem>

		<CreateItem Include="$(IntermediateOutputPath)$(AssemblyName).pdb"
			Condition="Exists('$(IntermediateOutputPath)$(AssemblyName).pdb')">
			<Output TaskParameter="Include" ItemName="FileWrites"/>
		</CreateItem>
	</Target>

	<!-- Get the list of files written, for clean -->
	<Target Name="_GetCleanFileWrites"
		DependsOnTargets="_GetCompileOutputsForClean">
		<ReadLinesFromFile File="$(IntermediateOutputPath)$(CleanFile)">
			<Output TaskParameter="Lines" ItemName="PreviousFileWrites"/>
		</ReadLinesFromFile>
	</Target>

	<Target Name="CleanReferencedProjects"
		DependsOnTargets="AssignProjectConfiguration">

		<!-- If building from .sln.proj or from IDE, clean will get handled by them,
		     else we are building a project directly, from the command line, so
		     clean the referenced projects -->
		<MSBuild Projects="@(ProjectReferenceWithConfigurationExistent)"
			Targets="Clean"
			Condition=" '$(BuildingSolutionFile)' != 'true' and '$(BuildingInsideVisualStudio)' != 'true' and '@(ProjectReferenceWithConfigurationExistent)' != ''" />

	</Target>

	<Target Name="Clean" DependsOnTargets="$(CleanDependsOn)"/>

	<!-- Override in project to run before/after clean tasks -->
	<Target Name="BeforeClean" />
	<Target Name="AfterClean" />

	<Target Name="CoreClean" DependsOnTargets="_GetCleanFileWrites">
		<Delete Files="@(PreviousFileWrites);@(FileWrites)" TreatErrorsAsWarnings="true"/>

		<!-- all previous files written for this platform/config have been deleted,
		     we can safely remove the file list now -->
		<Delete Files="$(IntermediateOutputPath)$(CleanFile)" TreatErrorsAsWarnings="true" />
	</Target>

	<PropertyGroup>
		<ImplicitlyExpandDesignTimeFacades>true</ImplicitlyExpandDesignTimeFacades>

		<ResolveReferencesDependsOn>
			$(ResolveReferencesDependsOn);
			ImplicitlyExpandDesignTimeFacades
		</ResolveReferencesDependsOn>

		<ImplicitlyExpandDesignTimeFacadesDependsOn>
			$(ImplicitlyExpandDesignTimeFacadesDependsOn);
			GetReferenceAssemblyPaths
		</ImplicitlyExpandDesignTimeFacadesDependsOn>
	</PropertyGroup>

	<Target Name="ImplicitlyExpandDesignTimeFacades" Condition="'$(ImplicitlyExpandDesignTimeFacades)' == 'true'" DependsOnTargets="$(ImplicitlyExpandDesignTimeFacadesDependsOn)">

		<PropertyGroup>
			<_HasReferenceToSystemRuntime Condition="'%(_ResolvedDependencyFiles.Filename)' == 'System.Runtime'">true</_HasReferenceToSystemRuntime>
		</PropertyGroup>

		<ItemGroup Condition="'$(_HasReferenceToSystemRuntime)' == 'true'">
			<!-- If the user has manually referenced these assemblies, remove them so we don't end up with duplicates -->
			<ReferencePath Remove="@(_DesignTimeFacadeAssemblies)"/>
			<ReferencePath Include="%(_DesignTimeFacadeAssemblies.Identity)">
				<WinMDFile>false</WinMDFile>
				<CopyLocal>false</CopyLocal>
				<ResolvedFrom>ImplicitlyExpandDesignTimeFacades</ResolvedFrom>
			</ReferencePath>
			<_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />
		</ItemGroup>

		<Message Importance="Low" Text="Including @(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />

	</Target>

	<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*"
		Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>
</Project>