Code Monkey home page Code Monkey logo

Comments (15)

github-actions avatar github-actions commented on August 11, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

from microsoft-ui-xaml.

lhak avatar lhak commented on August 11, 2024

As it looks that you have trimming enabled, you might want to try setting to "partial" in your .csproj file.

from microsoft-ui-xaml.

Fefedu973 avatar Fefedu973 commented on August 11, 2024

Where did you see trimming enabled, i don't see that in the csproj file ?
Should I add this ?

<PublishTrimmed>true</PublishTrimmed>
    <TrimmerDefaultAction>link</TrimmerDefaultAction>
    <TrimMode>partial</TrimMode>

EDIT: if this what i was supposed to do it didn't worked ):

from microsoft-ui-xaml.

lhak avatar lhak commented on August 11, 2024

Check your publish profile and see if PublishTrimmed is enabled there (according to your video, it seems to be). You might also want to try setting it to false.

from microsoft-ui-xaml.

Fefedu973 avatar Fefedu973 commented on August 11, 2024

Ok I found the settings but unfortunately it didn't worked I still have this annoying error and the app doesn't start at all.

Exception non gérée à 0x756A8984 (KernelBase.dll) dans App1.exe : 0xE0434352 (paramètres : 0x80131524, 0x00000000, 0x00000000, 0x00000000, 0x00640000).

from microsoft-ui-xaml.

lhak avatar lhak commented on August 11, 2024

I could reproduce this issue. It started working once I deleted the obj and bin folders once.

from microsoft-ui-xaml.

Fefedu973 avatar Fefedu973 commented on August 11, 2024

How did you do it because I just deleted bin and obj folders, re-run the publish process and my software still cannot start unfortunately );

from microsoft-ui-xaml.

lhak avatar lhak commented on August 11, 2024

I did the following steps:

-Create the new project
-Add TrimMode=partial, WindowsPackageType=None and WindowsAppSdkSelfContained=true setting to the csproj.
-Open the publish profile for the architecture and change PublishSingleFile to true.
-I also had to change win10-platform to win-platform in the publish profile. Somehow the .net version detection does not seem to work when publishing from visual studio which results in an error
-The app should now publish, but crashes during startup
-Delete the obj and bin folder
-Publish again
-App now starts

from microsoft-ui-xaml.

Fefedu973 avatar Fefedu973 commented on August 11, 2024

Wait it finally worked thank you !!!!! Tbh I don't know what I have done differently

from microsoft-ui-xaml.

abdx79 avatar abdx79 commented on August 11, 2024

Wait it finally worked thank you !!!!! Tbh I don't know what I have done differently

can you share your project files. I'm having the same issue.

from microsoft-ui-xaml.

Fefedu973 avatar Fefedu973 commented on August 11, 2024

Yes of course it's on my GitHub

from microsoft-ui-xaml.

Fefedu973 avatar Fefedu973 commented on August 11, 2024

Don't look the code too closely it's bad 😅 (it's my first native windows app ever) but you can just wipe all the code and put your code instead and it should work
https://github.com/Fefedu973/PowerToys-Run-Plugin-Updater

from microsoft-ui-xaml.

abdx79 avatar abdx79 commented on August 11, 2024

Don't look the code too closely it's bad 😅 (it's my first native windows app ever) but you can just wipe all the code and put your code instead and it should work https://github.com/Fefedu973/PowerToys-Run-Plugin-Updater

man you are too generous, thank you. let see if it works.

from microsoft-ui-xaml.

Fefedu973 avatar Fefedu973 commented on August 11, 2024

Does it work ?

from microsoft-ui-xaml.

abdx79 avatar abdx79 commented on August 11, 2024

It works!,

It works after adding these

    <WindowsPackageType>None</WindowsPackageType>
    <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
    <TrimMode>partial</TrimMode>

in <PropertyGroup> in .csproj file and doing the following changes in PublishProfiles.

The majority of changes happens in publish profile where I only wanted to publish x64 version.

publish profile address: YourProject\Properties\PublishProfiles

Working: Project1.xml

Not working: Project2.xml

File 1: Project1.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PublishProtocol>FileSystem</PublishProtocol>
    <Platform>x64</Platform>
    <RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x64</RuntimeIdentifier>
    <RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win-x64</RuntimeIdentifier>
    <PublishDir>bin\\\win10-x64\publish\</PublishDir>
    <SelfContained>true</SelfContained>
    <PublishSingleFile>true</PublishSingleFile>
    <PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
    <PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">true</PublishReadyToRun>
    <PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
    <PublishTrimmed Condition="'$(Configuration)' != 'Debug'">false</PublishTrimmed>
    <Configuration>Release</Configuration>
    <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
  </PropertyGroup>
</Project>

File 2: Project2.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PublishProtocol>FileSystem</PublishProtocol>
    <Platform>x64</Platform>
    <RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x64</RuntimeIdentifier>
    <RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
    <PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
    <SelfContained>true</SelfContained>
    <PublishSingleFile>False</PublishSingleFile>
    <PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
    <PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
    <PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
    <PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
  </PropertyGroup>
</Project>

Differences between Project1.xml and Project2.xml

  1. RuntimeIdentifier Property:

    • Project1.xml: Uses win-x64 regardless of the target framework version.
    • Project2.xml: Uses win-x64 for target framework versions >= 8 and win10-x64 for versions < 8.
  2. PublishDir Property:

    • Project1.xml: Uses a hardcoded path bin\\\win10-x64\publish\.
    • Project2.xml: Uses a dynamic path bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\.
  3. PublishSingleFile Property:

    • Project1.xml: Set to true.
    • Project2.xml: Set to False.
  4. PublishTrimmed Property:

    • Project1.xml: Set to False in both Debug and non-Debug configurations.
    • Project2.xml: Set to False in Debug and True in non-Debug configurations.
  5. Configuration Property:

    • Project1.xml: Explicitly set to Release.
    • Project2.xml: Not explicitly set (it relies on the build configuration being used).

The generated exe file in \bin\win10-x64\publish works in my Computer but I'm not sure that it will work in other Computers,
Will it work ?
Thanks!

from microsoft-ui-xaml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.