You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Publishing as NativeAOT should not depend on AppHost #79575
Could not copy the file "/__w/1/s/artifacts/bin/trimmingTests/projects/System.Diagnostics.DiagnosticSource.NativeAotTests/DiagnosticSourceEventSourceTests/linux-x64/obj/Release/net8.0/linux-x64/apphost" because it was not found.
This is probably not just a test issue, but also a product issue. Historically the NativeAOT targets were just an addon to the SDK targets that hacked into the SDK (we e.g. delete outputs the SDK produces in publish and replace them with NativeAOTd stuff).
The SDK probably needs to become more aware of what NativeAOT does and suppress some behaviors.
That error can be avoided by setting <UseAppHost>false</UseAppHost> but that will then raise the next error:
C:\Program Files\dotnet\sdk\7.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(186
,5): error NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained t
o false or set UseAppHost to true. [C:\temp\useaphost\useaphost.csproj]
Yeah, the SDK needs to be taught that PublishAot is sort of like self contained, but it doesn't need an apphost. I probably should have opened this in the SDK repo because the main fix will likely be in the SDK, but SDK repo is where issues typically go die of neglect and loneliness.
Make UseAppHost default to false when '$(PublishAot)' == 'true'
We do want to keep using app host for dotnet run or F5 in Visual Studio. I do not think we want to change the global default to false when PublishAot is set.
Activity
ViktorHofer commentedon Dec 13, 2022
That error can be avoided by setting
<UseAppHost>false</UseAppHost>but that will then raise the next error:MichalStrehovsky commentedon Dec 13, 2022
Yeah, the SDK needs to be taught that PublishAot is sort of like self contained, but it doesn't need an apphost. I probably should have opened this in the SDK repo because the main fix will likely be in the SDK, but SDK repo is where issues typically go die of neglect and loneliness.
ViktorHofer commentedon Dec 13, 2022
I would imagine that with the following modifications in the SDK, we should be able to publish without the apphost requirement:
'$(PublishAot)' != 'true'to this condition: https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets#L200-L201UseAppHostdefault to false when'$(PublishAot)' == 'true': https://github.com/dotnet/sdk/blob/b6898d6622ea223cbf53e6a6041803213f67f73f/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets#L144jkotas commentedon Dec 13, 2022
We do want to keep using app host for
dotnet runorF5in Visual Studio. I do not think we want to change the global default to false when PublishAot is set.Don't set UseApphost or SelfContained to true for PublishAot
Stop building AppHost in native AOT testing
Stop building AppHost in native AOT testing (#101270)
Stop building AppHost in native AOT testing (dotnet#101270)
Stop building AppHost in native AOT testing (dotnet#101270)