Skip to content

Commit 7213976

Browse files
Have NativeAOT test execution project include SDK (#62927)
* Have NativeAOT test execution project include SDK The SDK contains logic to configure trimming - we were skipping all of that. We couldn't previously include the SDK because it would reflection-root the entrypoint assembly. No longer the case after #62890.
1 parent 3424923 commit 7213976

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/tests/Common/CLRTest.NativeAot.targets

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,26 @@ if defined RunNativeAot (
139139
Outputs="$(OutputPath)\nativebuild.proj"
140140
BeforeTargets="Build">
141141
<PropertyGroup>
142-
<_RootEntryAssemblyLine Condition="$(CLRTestFullTrimming) != 'true'">&lt;TrimmerDefaultAction&gt;copyused&lt;/TrimmerDefaultAction&gt;</_RootEntryAssemblyLine>
142+
<_RootEntryAssemblyLine Condition="$(CLRTestFullTrimming) == 'true'">&lt;TrimmerDefaultAction&gt;link&lt;/TrimmerDefaultAction&gt;</_RootEntryAssemblyLine>
143143

144144
<_NativeAotBuildProjectFile>
145145
<![CDATA[
146-
<Project DefaultTargets="LinkNative" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
146+
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="LinkNative">
147147
148148
<PropertyGroup>
149149
<TargetName>$(MSBuildProjectName)</TargetName>
150-
<TargetExt>.dll</TargetExt>
150+
<TargetFramework>$(TargetFramework)</TargetFramework>
151151
<OutputType>Exe</OutputType>
152152
<OutputPath>%24(MSBuildProjectDirectory)\</OutputPath>
153153
<IntermediateOutputPath>%24(MSBuildProjectDirectory)\</IntermediateOutputPath>
154154
<TargetArchitecture>$(TargetArchitecture)</TargetArchitecture>
155155
<Optimize>$(Optimize)</Optimize>
156-
<DebugSymbols>true</DebugSymbols>
157-
<NETCoreSdkVersion>$(NETCoreSdkVersion)</NETCoreSdkVersion>
156+
<SkipResolvePackageAssets>true</SkipResolvePackageAssets>
157+
<SelfContained>true</SelfContained>
158+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
159+
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
160+
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
161+
<RuntimeIdentifier>$(OutputRid)</RuntimeIdentifier>
158162
$(_RootEntryAssemblyLine)
159163
</PropertyGroup>
160164
@@ -169,9 +173,9 @@ if defined RunNativeAot (
169173
</ItemGroup>
170174
171175
<!-- We don't do anything in the Compile step since the test is already compiled to IL - the AOT compiler hooks up after this -->
172-
<Target Name="Compile" />
176+
<Target Name="CoreCompile" />
173177
174-
<Target Name="PrepareForILLink" />
178+
<Target Name="CreateManifestResourceNames" />
175179
176180
<Import Project="%24(IlcPath)\build\Microsoft.NETCore.Native.targets" />
177181

0 commit comments

Comments
 (0)