1
+ <!--
2
+ The targets in this file resolve References to ANCM into ProjectReferences,
3
+ with the right MSBuild incantations to get output copied to the right place.
4
+ -->
5
+ <Project >
6
+ <Choose >
7
+ <!-- IIS native projects only build on Windows with MSBuild.exe -->
8
+ <When Condition =" '$(OS)' == 'Windows_NT' AND '$(MSBuildRuntimeType)' != 'Core' " >
9
+ <ItemGroup Condition =" '@(Reference->AnyHaveMetadataValue('Identity', 'AspNetCoreModuleV1'))' == 'true' " >
10
+ <Reference Remove =" AspNetCoreModuleV1" />
11
+ <NativeProjectReference Include =" $(MSBuildThisFileDirectory)src\AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj" />
12
+ </ItemGroup >
13
+
14
+ <ItemGroup Condition =" @(NativeProjectReference->Count()) != 0" >
15
+ <!-- TODO: investigate building just one arch at a time. -->
16
+ <ProjectReference Include =" @(NativeProjectReference)" >
17
+ <!-- Set the arch-->
18
+ <SetPlatform >Platform=x64</SetPlatform >
19
+ <!-- The base path for the output. -->
20
+ <LinkBase >x64\%(HandlerPath)\</LinkBase >
21
+ <!-- This reference assembly doesn't need -->
22
+ <ReferenceOutputAssembly >false</ReferenceOutputAssembly >
23
+ <!-- NativeContent is a custom type of item group which is assigned a target path after project references are resolved. -->
24
+ <OutputItemType >NativeContent</OutputItemType >
25
+ <!-- Set the copy policy. -->
26
+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
27
+ <!-- This instructs the ProjectRef protocol to collect symbols as well as built output -->
28
+ <Targets >Build;BuiltProjectOutputGroup;DebugSymbolsProjectOutputGroup</Targets >
29
+ <!-- Optimization. Native projects don't have a .NET TargetFramework -->
30
+ <SkipGetTargetFrameworkProperties >true</SkipGetTargetFrameworkProperties >
31
+ <UndefineProperties >TargetFramework</UndefineProperties >
32
+ <!-- Don't put this reference into generated .nuspec -->
33
+ <PrivateAssets >All</PrivateAssets >
34
+ <!-- Publish assets from this reference -->
35
+ <Publish >true</Publish >
36
+ </ProjectReference >
37
+
38
+ <ProjectReference Include =" @(NativeProjectReference)" >
39
+ <!-- Set the arch-->
40
+ <SetPlatform >Platform=x86</SetPlatform >
41
+ <!-- The base path for the output. -->
42
+ <LinkBase >x86\%(HandlerPath)\</LinkBase >
43
+ <!-- This reference assembly doesn't need -->
44
+ <ReferenceOutputAssembly >false</ReferenceOutputAssembly >
45
+ <!-- NativeContent is a custom type of item group which is assigned a target path after project references are resolved. -->
46
+ <OutputItemType >NativeContent</OutputItemType >
47
+ <!-- Set the copy policy. -->
48
+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
49
+ <!-- This instructs the ProjectRef protocol to collect symbols as well as built output -->
50
+ <Targets >Build;BuiltProjectOutputGroup;DebugSymbolsProjectOutputGroup</Targets >
51
+ <!-- Optimization. Native projects don't have a .NET TargetFramework -->
52
+ <SkipGetTargetFrameworkProperties >true</SkipGetTargetFrameworkProperties >
53
+ <UndefineProperties >TargetFramework</UndefineProperties >
54
+ <!-- Don't put this reference into generated .nuspec -->
55
+ <PrivateAssets >All</PrivateAssets >
56
+ <!-- Publish assets from this reference -->
57
+ <Publish >true</Publish >
58
+ </ProjectReference >
59
+
60
+ <NativeProjectReference Remove =" @(NativeProjectReference)" />
61
+ </ItemGroup >
62
+ </When >
63
+ </Choose >
64
+
65
+ <Target Name =" _GetNativeContentCopyToOutputDirectoryItems"
66
+ BeforeTargets =" GetCopyToOutputDirectoryItems"
67
+ DependsOnTargets =" ResolveProjectReferences" >
68
+
69
+ <ItemGroup >
70
+ <!-- Prepend LinkBase to output path. -->
71
+ <NativeContent >
72
+ <Link >%(LinkBase)%(FileName)%(Extension)</Link >
73
+ <!-- Don't put this content in a nuget package. -->
74
+ <Pack >false</Pack >
75
+ </NativeContent >
76
+ </ItemGroup >
77
+
78
+ <!-- Add the item to the ContentWithTargetPath group, which is then used by GetCopyToOutputDirectoryItems to copy to the correct output location. -->
79
+ <AssignTargetPath Files =" @(NativeContent)" RootFolder =" $(MSBuildProjectDirectory)" >
80
+ <Output TaskParameter =" AssignedFiles" ItemName =" ContentWithTargetPath" />
81
+ </AssignTargetPath >
82
+ </Target >
83
+ </Project >
0 commit comments