Define for Os version in C#

前端 未结 2 1238
醉梦人生
醉梦人生 2021-01-25 10:55

I have a problem, I cannot find a way to detect windows version at compilation time.

My purpose is to create an executable that depend on Interface, which are defined on

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-25 11:02

    Do you want to trigger compilation of some source code from the running application? I could imagine this is possible. In that case, you should be able to find OS version in Environment.OSVersion

    But better approach would be :

    .. include code for all versions and determine which code to call at runtime ..

    as proposed by CodeCaster in comments.

提交回复
热议问题