给编译出的程序添加图标(exe的图标)
安装依赖:
go get github.com/akavel/rsrc
在对应程序的源码路径下创建manifest文件,图标也要放进去(xxx.ico), 命名:main.exe.manifest :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.0" processorArchitecture="x86" name="controls" type="win32" ></assemblyIdentity> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" ></assemblyIdentity> </dependentAssembly> </dependency> </assembly> |
生成syso文件:
rsrc -manifest main.exe.manifest -ico rc.ico -o main.syso
编译:
go build -o main.exe