Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Visual Studio does not generate proper .csproj file when using mcs.rsp file

Discussion in 'Code Editors & IDEs' started by Vlad_B, Jul 16, 2018.

  1. Vlad_B

    Vlad_B

    Joined:
    Oct 14, 2012
    Posts:
    1
    Issue: When attempting to use a managed .dll from .Net 4.x (such as System.Net.Http for example), I do as suggested and put the reference into an mcs.rsp file by adding the line "-r:System.Net.Http.dll". When going into Visual Studio (tested with 2015 and 2017), there is no reference to System.Net.Http in my references, and any calls to that .dll cause errors in visual studio.

    When I open the .csproj file, there is no reference made to System.Net.Http. When I do make calls from System.Net.Http, they seem to work in Unity just fine, and seems to only be an issue in Visual Studio. When I put in the references in manually, VS finds it
    Example of .csproj syntax:

    <Reference Include="System.Net.Http">
    <HintPath>C:/Program Files/Unity_2018_1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Net.Http.dll</HintPath>
    </Reference>


    I also put a precompiler directive (-define:BANANA) to make sure the .rsp file was being processed, and this seemed to show up correctly in VS and the .csproj file.

    It seems to make the csproj with the appropriate references when I use the .NET standard 2.0 API Compatability Level, but throws error CS0006 in Unity (Which I'm assuming to be expected behaviour)

    In conclusion, the issue seems to be that Unity is not using the references specified in the mcs.rsp file when generating the .csproj file for API compatibility .Net 4.X. Any insights into this issue would be great.
     
    bgulanowski likes this.
  2. geertm

    geertm

    Joined:
    May 3, 2018
    Posts:
    5
    I'm experiencing the same issue. Any updates on this?
     
  3. dsx75

    dsx75

    Joined:
    Apr 22, 2017
    Posts:
    11
    The same issue here as well.