question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TargetExt conflicts with UseAppHost

See original GitHub issue

TargetExt defaults to “.dll” on .NETCore and .NETStandard even if the OutputType is “.exe”: https://github.com/dotnet/sdk/blob/90e8a529be026d06fc8965d460927193aca5b005/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets#L74-L75

Starting with “.NETCoreApp, Version=3.0”, UseAppHost defaults to true: https://github.com/dotnet/sdk/blob/372e67d51167792db2fdaeebf48b6d8fb962e713/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets#L110

The _NativeExecutableExtension defaults to true as the DefaultAppHostRuntimeIdentifier on Windows is “win-x64”: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L67

The _GetAppHostPaths target sets the AppHostIntermediatePath property (based on _NativeExecutableExtension which defaults to “.exe” because auf UseAppHost is true) which then is added to the None ItemGroup determined to be copied to the output directory: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L491-L497

image

The issue is that such a file is never produced as the TargetExt defaults to “.dll”. If I got this right this means that every app “.NETCoreApp, Version=3.0” with OutputType “Exe” fails to copy its content to the output directory. This would be big break and I’m sure this would have already been caught. I assume I’m missing something here.

cc @nguerrera @dsplaisted @ericstj

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
ericstjcommented, Jun 3, 2019

Yeah. Makes sense.

I think the SDK should have a test case for what it looks like to build a project without framework reference and compose references on our own. That way when new features/fixes break this it’s clearer and the SDK has the ability to look at it and create an intentional override/disable path. Otherwise we’ll end up growing an ugly set of workarounds that neither side is happy with.

In the past we could rely on a couple properties like DisableImplicitFrameworkReference and maybe something to turn off deps/runtimeconfig, but lately it seems like each milestone grows the set of workarounds we accumulate for this scenario.

0reactions
ViktorHofercommented, Jun 10, 2019

Make sense?

Yes makes sense. I understand that this is not critical for customers but for partners like aspnetcore and us it is. How much work do you think this would be?

Read more comments on GitHub >

github_iconTop Results From Across the Web

UseAppHost property is not respected in project
It appears that when compiling .NET 5 or 6 projects in VS 2022 for Mac, the UseAppHost property is set globally to false...
Read more >
Untitled
PackTool.targets.html TargetExt conflicts with UseAppHost · Issue #3295 · … ... Here is my recollection of the time line for my experience with...
Read more >
https://support.postsharp.net/api/v1/request/28805...
'true' and '$(UseAppHost)' == 'true' and '$(_TargetFrameworkVersionWithoutV)' < '2.1') ... Debug TargetExt = .dll TargetFileName = Journals.
Read more >
build_output.txt - GitHub
NETCoreApp,Version=v3.0;RuntimeIdentifier=;SelfContained=false;UseApphost=true;OutputType=WinExe 1> Done executing task "AllowEmptyTelemetry".
Read more >
No interop libs with net48 and sqlite1.0.113 or higher
Hey, if you use net48 and sqlite1.0.113 or higher you don't get interop libs anymore. this example still works without problems: <Project ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found