akavel / rsrc

Tool for embedding .ico & manifest resources in Go programs for Windows.
MIT License
1.22k stars 122 forks source link

Icon is not assigned #39

Open hasanAjsf opened 3 years ago

hasanAjsf commented 3 years ago

I'm at Windows 11, and have the below:

  1. app.ico
  2. app.exe.manifest
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <assemblyIdentity
        type="win32"
        name="myApp"
        version="1.0.0.0"
        processorArchitecture="*"
    />
    <description>Contoso Example Application</description>
    <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
            <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
        </windowsSettings>
    </application>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <!-- Windows 10 -->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>s
        </application>
    </compatibility>
        <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <!--
                  UAC settings:
                  - app should run at same integrity level as calling process
                  - app does not need to manipulate windows belonging to
                    higher-integrity-level processes
                  -->
                <requestedExecutionLevel
                    level="asInvoker"
                    uiAccess="false"
                />   
            </requestedPrivileges>
        </security>
    </trustInfo>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win64" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
        </dependentAssembly>
    </dependency>
    </assembly>
  3. release.bat
    rsrc -manifest app.exe.manifest -ico=app.ico -o rsrc.syso
    go build -ldflags="-H windowsgui" readpdf.go

    Upon running the release.bat file, the output file had been generated as readpdf.exe not as mentioned in the manifest file, and does not have the required icon?

akavel commented 3 years ago

Thanks for reporting!

  1. By chance, do you know if there's some way I can test stuff on Windows 11 without upgrading my only machine that has Windows 10 installed? I only learnt about Win 11 even existing from this issue you reported, I'm apparently quite out of the loop 😅
  2. Not sure what do you mean by "not as mentioned in the manifest file"? Could I kindly ask you to try and explain it to me more simply, assuming I don't really know anything about manifest files (...which is true...)?
lostsource commented 1 year ago
  1. release.bat
rsrc -manifest app.exe.manifest -ico=app.ico -o rsrc.syso
go build -ldflags="-H windowsgui" readpdf.go

I had a similar issue and fixed it by running go build -ldflags="-H windowsgui" without the readpdf.go entry point.