none
MediaTypeHeaderValue RRS feed

  • Question

  • Hi,

    I'm using the >NET WebAPI to create an API. I added all the necessary documentations for the API using XML. When I build my code, it builds successfully and runs perfectly fine on my local. However I an error for MediaTypeHeaderValue in the following line in the "Samples.cshtml" file - 

    @model Disctionary<MediaTypeHeaderValue, object>

    When I run the solution it displays the following compilation error -

    The type 'Dictionary<,>' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

    Line 7:  
    Line 8:      // Group the samples into a single tab if they are the same.
    Line 9:      Dictionary<string, object> samples = Model.GroupBy(pair => pair.Value).ToDictionary(
    Line 10:         pair => String.Join(", ", pair.Select(m => m.Key.ToString()).ToArray()), 
    Line 11:         pair => pair.Key);
     

    For some reason, my API calls are also failing due to this (I suppose). 

    I'm using the .NET Framework 4.5.2 and the System.Net.Http version is 4.0.0.0.

    Can someone please help me get around this problem.

    Thanks a lot - Neha

    Wednesday, February 21, 2018 7:01 AM

All replies

  • Hi Neha05Sharma,

    Thank you for posting here.

    According to your question is more related to web API, you could post a new thread in WEB API forum for suitable support.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 22, 2018 6:03 AM