Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Desktop] OutputType cannot be changed #17719

Closed
jeromelaban opened this issue Jul 26, 2024 · 6 comments · Fixed by #17974
Closed

[Desktop] OutputType cannot be changed #17719

jeromelaban opened this issue Jul 26, 2024 · 6 comments · Fixed by #17974
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@jeromelaban
Copy link
Member

jeromelaban commented Jul 26, 2024

Current behavior

Setting <OutputType>Exe</OutputType> does not have an effect on skia desktop and still shows the console on windows.

Expected behavior

The console does not show.

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

<Target Name="__OverrideOutputType" BeforeTargets="BeforeBuild">
  <PropertyGroup>
   <OutputType>WinExe</OutputType>
  </PropertyGroup>
</Target>

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@jeromelaban jeromelaban added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jul 26, 2024
@ArchieCoder
Copy link
Contributor

I put the workaround near the end of the project, but it does not work.

image

@Youssef1313
Copy link
Member

@ArchieCoder If you want to hide the console, you probably need WinExe?

@ArchieCoder
Copy link
Contributor

ArchieCoder commented Jul 26, 2024

@Youssef1313 I tried but it does not work

<Project Sdk="Uno.Sdk">
  <PropertyGroup>
    <TargetFrameworks>
      net8.0-windows10.0.19041;
      net8.0-desktop;
    </TargetFrameworks>

    <OutputType>Exe</OutputType>
    <UnoSingleProject>true</UnoSingleProject>
    <UnoSplashScreenColor>#F9F9F9</UnoSplashScreenColor>
    <!-- Display name -->
    <ApplicationTitle>Elements Technician</ApplicationTitle>
    <!-- App Identifier -->
    <ApplicationId>com.Enteligent.ElementsTechnician</ApplicationId>
    <!-- Versions -->
    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
    <ApplicationVersion>1</ApplicationVersion>
    <!--
      If you encounter this error message:

        error NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll.
        Please update to a newer .NET SDK in order to reference this assembly.

      This means that the two packages below must be aligned with the "build" version number of
      the "Microsoft.Windows.SDK.BuildTools" package above, and the "revision" version number
      must be the highest found in https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref.
    -->
    <!-- <WindowsSdkPackageVersion>10.0.22621.28</WindowsSdkPackageVersion> -->

    <!--
      UnoFeatures let's you quickly add and manage implicit package references based on the features you want to use.
      https://aka.platform.uno/singleproject-features
    -->
    <UnoFeatures>
      Lottie;
      Hosting;
      Toolkit;
      Logging;
      LoggingSerilog;
      Mvvm;
      Configuration;
      Http;
      Serialization;
      Localization;
      Navigation;
    </UnoFeatures>
  </PropertyGroup>

  <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
    <PackageReference Include="CommunityToolkit.WinUI.UI.Controls" />
    <PackageReference Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" />
    <PackageReference Include="CommunityToolkit.WinUI.UI" />
    <PackageReference Include="WinUIEx" />
    <!-- Add more community toolkit references here -->
  </ItemGroup>
  <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'">
    <PackageReference Include="Uno.CommunityToolkit.WinUI.UI.Controls" />
    <PackageReference Include="Uno.CommunityToolkit.WinUI.UI.Controls.DataGrid" />
    <PackageReference Include="Uno.CommunityToolkit.WinUI.UI" />
    <!-- Add more uno community toolkit references here -->
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
    <PackageReference Include="MQTTnet" />
    <PackageReference Include="Newtonsoft.Json" />
    <PackageReference Include="Uno.Fonts.OpenSans" />
    <PackageReference Include="Zeroconf" />
  </ItemGroup>

  <Target Name="__OverrideOutputType" BeforeTargets="BeforeBuild">
    <PropertyGroup>
      <OutputType>WinExe</OutputType>
    </PropertyGroup>
  </Target>

</Project>

@agneszitte
Copy link
Contributor

@rajamatt if you can help verify if @dansiegel changes (#17974) will fix the issue please

@jeromelaban
Copy link
Member Author

@ArchieCoder using 5.4.5, this is preventing the console from showing:

  <PropertyGroup>
    <TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-windows10.0.19041;net8.0-browserwasm;net8.0-desktop</TargetFrameworks>

    <OutputType>Exe</OutputType>
    <OutputType Condition="'$(TargetFramework)'=='net8.0-desktop'">WinExe</OutputType>

The only linked issue is that the hot reload tooling (MainWindow.EnableHotReload()) is disabled incorrectly when this happens that we'll fix separately.

@ArchieCoder
Copy link
Contributor

@jeromelaban Tested! Thank you a lot for this one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants