Answered Project.MetadataReferences broken?

  • Thursday, December 08, 2011 8:11 AM
     
      Has Code
    IProject.MetadataReferences only seems to return mscorlib.dll and system.core.dll
    The opened project is a standard VS 2010 project and compiles in VS 2010
    Any idea?

    var srcProj = Solution.LoadStandAloneProject("../../../TestSubject/TestSubject.csproj");
    var srcSol = srcProj.Solution;
    
    var symSol = Solution.Create(srcSol.Id);
    symSol = symSol.AddCSharpProject(srcProj.Id, srcProj.AssemblyName + ".sym", srcProj.DisplayName + ".sym");
    symSol = symSol.AddMetadataReferences(srcProj.Id, srcProj.MetadataReferences);
    
    

All Replies

  • Thursday, December 08, 2011 8:01 PM
    Owner
     
     Answered

    Hi Tobias - this looks like the same bug that was reported on this thread - you can find a workaround for this issue on the same thread (i.e. use 'platform:"x86"' when loading the project). The issue was reported here on connect and is already fixed for the next public release.

    Please let us know if you think the issue you are seeing is not the same as the above one.


    Shyam Namboodiripad | Software Development Engineer in Test | Roslyn Compilers Team
    • Marked As Answer by Tobias Käs Thursday, December 08, 2011 8:56 PM
    •  
  • Thursday, December 08, 2011 8:55 PM
     
      Has Code

    Yep, seems to be the same issue. I think Roslyn shouldn't pass any "Debug" or "AnyCpu" flags to MsBuild to allow the project file selecting the defaults. In all my projects (generated by VisualStudio) I can find something along the lines of this:

     

    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    
    

    • Edited by Tobias Käs Thursday, December 08, 2011 8:56 PM
    •