1

When I try to compile a C# file with an icon it works up to a size of 256x256 pixels but when I try it on another computer with Windows XP it throws an error and only works with a size up to 128x128 pixels.

My way to solve it was to try 256 first and if it throws an error try 128:

SET CompilerPath=%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc.exe
CALL %CompilerPath% -win32icon:Icon256.ico Code.cs && (
  ECHO Successfully compiled with icon 256.
) || (
  CALL %CompilerPath% -win32icon:Icon128.ico Code.cs && (
    ECHO Successfully compiled with icon 128.
  ) || (
    ECHO Failed to compile.
  )
)

My question is if there is an actual way to check which size the computer/OS supports.

user7393973
  • 2,270
  • 1
  • 20
  • 58
  • Here's a possibly useful [question](https://stackoverflow.com/q/3236115) and answers. – Compo Dec 09 '19 at 17:42
  • @Compo That's helpful to see the different sizes that people have found to be used in different Windows versions but doesn't really help find the maximum size supported. I don't think doing it in a way like `if windows version < limit then 128 else 256` is the best way to go with it. I would expect some Windows registry or command to tell me size limit. – user7393973 Dec 09 '19 at 18:44

0 Answers0