VS2015 C # interactive: error CS7069: a reference to the type "Object" claims to be defined in "System.Runtime" but could not be found

I just upgraded to VS2015 Update 2 and started playing with the C # Interactive Window . I wanted to use the static method in a static class in one of my target projects in the .NET 4.0 library, so I right-clicked the project in the solution explorer and selected Initialize Interactive with Project . The result in the interactive window is as follows (for brevity, I replaced some of the full paths with ".."):

 #reset Resetting execution engine. Loading context from 'CSharpInteractive.rsp'. #r "..\src\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll" #r "..\src\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll" #r "..\src\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" #r "..\src\packages\Microsoft.Bcl.1.1.8\lib\net40\System.IO.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Net.dll" #r "..\src\packages\Microsoft.Bcl.1.1.8\lib\net40\System.Runtime.dll" #r "..\src\packages\Microsoft.Bcl.1.1.8\lib\net40\System.Threading.Tasks.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.DataSetExtensions.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll" #r "C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Net.Http.dll" #r "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" #r "MyDll.dll" using MyDll; (1,7): error CS7069: Reference to type 'Object' claims it is defined in 'System.Runtime', but it could not be found 

Notice the nasty little line at the end, blocking my path to happiness:

(1,7): error CS7069: a reference to the type "Object" claims to be defined in "System.Runtime", but could not be found

I get intellisense for classes in a project, but I get the same error anytime I try to run an instruction. I can still do simple things like:

 > string.Format("No one knows my {0}", "suffering") "No one knows my suffering" > 

Anyone have any ideas on why this is happening or how to fix it? I will update this question with any successful corrections proposed.

+6
source share
1 answer

What ultimately fixed this for me, I entered this right in C # Interactive window .:

#r "System.Runtime"

If anyone who can give a detailed explanation of why this worked, I would like to give you an accepted answer. I was just lucky.

+5
source

Source: https://habr.com/ru/post/1247444/


All Articles