question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New files showing type or namespace not found but it is their

See original GitHub issue

Environment data

dotnet --info output: NET Command Line Tools (2.1.4)

Product Information: Version: 2.1.4 Commit SHA-1 hash: 5e8add2190

Runtime Environment: OS Name: Mac OS X OS Version: 10.12 OS Platform: Darwin RID: osx.10.12-x64 Base Path: /usr/local/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

Version : 2.0.5 Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54

VS Code version: 1.21.1 C# Extension version: 1.14.0

Steps to reproduce

Create a new file after loading a Unity Project

Expected behavior

No Error

Actual behavior

The editor is showing red line with type or namespace could not be found when it is actually their. I can go to definition and it loads the right file, the code compiles and executes properly in Unity.

screen shot 2018-03-25 at 9 11 31 am

Not sure what could cause this. I know if I do:

dotnet build Assembly-CSharp.csproj

I get the following error (same error when I do a build on any of the Unity csproj files):

Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Nothing to do. None of the projects specified contain packages to restore.
/usr/local/share/dotnet/sdk/2.1.4/Microsoft.Common.CurrentVersion.targets(1124,5): error 
MSB3644: The reference assemblies for framework ".NETFramework,Version=v3.5" were 
not found. To resolve this, install the SDK or Targeting Pack for this framework version or 
retarget your application to a version of the framework for which you have the SDK or 
Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly 
Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly 
may not be correctly targeted for the framework you intend. 
[/repositories/arpg-project/Assembly-CSharp.csproj]

Build FAILED.

/usr/local/share/dotnet/sdk/2.1.4/Microsoft.Common.CurrentVersion.targets(1124,5): error 
MSB3644: The reference assemblies for framework ".NETFramework,Version=v3.5" were 
not found. To resolve this, install the SDK or Targeting Pack for this framework version or 
retarget your application to a version of the framework for which you have the SDK or 
Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly 
Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly 
may not be correctly targeted for the framework you intend. 
[/repositories/arpg-project/Assembly-CSharp.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.60

However I don’t seem to see that error in the vscode output logs (I only get this when I run dotnet manually). I have tried this with both 5.8.0 and 5.10.0 of Mono installed and can’t figure it out.

This same code / project load fine and shows no errors in Rider.

Any help in trying to debug this would be awesome.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rchandecommented, Feb 8, 2019

For those following along here, feel free to file an issue using the command “CSharp: report an issue” from VS Code.

0reactions
spiripicchiocommented, Feb 1, 2019

Same issue here on Windows 10. Can we reopen this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "type or namespace name could not be found" but ...
I recently moved the solution to VS2012 from VS2010, and had created one new class library in VS2012. All of a sudden I...
Read more >
C# the type or namespace name could not be found (are you ...
The problem is that it can't find the class - it's not in the same namespace as your current code. That may be...
Read more >
Getting “type or namespace name could not be found” but ...
Hi there, After I updated to latest vs2017(15.8.1), even everything looks good, project compiled successful and running without any issues.
Read more >
"The type or namespace name 'ClassName' does not exist ...
FIX: "The type or namespace name 'ClassName' does not exist" error message when you try to build a Visual C# Windows Form solution...
Read more >
Error: The type or namespace name Models does not exist in ...
https://codedocu.com/Details?d=2807&a=9&f=344&l=0Asp Core Error: The type or namespace name 'ArticleModels' does not exist in the namespace ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found