Need apphost in build but do not pack it #3505
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #3023
Description
Apphost generation is disabled for dotnet tools to prevent the apphost from being packaged in the package. When debugging a WPF or Winforms project that has PackAsTool set to true, there is no exe generated with appropriate Windows PE bits set, because we disabled it as described above. Instead of disabling apphost generation when PackAsTool=true, SDK should generate it during build, but prevent it from being packaged in the nupkg.
Customer Impact
When debugging an WPF or Winforms dotnet tool project (PackAsTool=true) in VS, the user would see the command line instead of the GUI. The app's GUI is not rendered and you get only a blank command prompt.
Regression?
Yes. This regressed from .NET Core SDK 3.0.100-preview3 due to 3487007
Risk
Low risk.
Test changes in this PR
Added new unit test coverage to ensure
RunCommand(which VS debug calls) uses the apphost exe instead of the dll.