How do we determine whether we are using Web API 1 or Web API 2?

前端 未结 3 575
轻奢々
轻奢々 2021-02-04 23:31

Introduce the problem

I would like to know whether we are using Web API 1 or 2. My own packages.config indicates version 5.0.0. Is that Web API 1 or 2?<

3条回答
  •  甜味超标
    2021-02-04 23:35

    I always try this instead -

    In the controller make a method

    public IHttpActionResult MyResult(){
        return Ok();
    }
    

    If you get compilation error then it is API 1.0.

    If no compilation error then you are referencing API 2.0.

提交回复
热议问题