Visual Studio 中代码编译通过, 但是Resharper依然报错.

工程编译没有任何报错, 但是 在代码编辑器中, Resharper 始终提示代码有错误.

解决方案来源: https://stackoverflow.com/questions/17703004/visual-studio-displaying-errors-even-if-projects-build

Here's a collection of popular answers. Upvote the OP of the answer if it helped you:

Option 1: Clean, Build and Refresh (@Mike Fuchs's option)

As @Mike Fuchs mentioned, try the following operations:

In menu, Build > Clean Solution

then build it:

In menu, Build > Build Solution

and finally Refresh:

Option 2: Clean, Close, Restart and Build (@Pixel's option)

As @Pixel mentioned, try the following sequence of operations:

  1. Clean the solution
  2. Close Visual Studio
  3. Open Visual Studio
  4. Build solution

Option 3: Clear ReSharper cache

If you have ReSharper, try emptying the ReSharper cache:

In menu, ReSharper > Options > Environment > General > Clear Caches

and disabling and re-enabling ReSharper:

In menu, Tools > Options > ReSharper > General > Suspend / Restore

Option 4: Delete the .suo file (@Neolisk's option)

As @Neolisk mentioned, deleting the .suo file might solve your problem. For Visual Studio 2015, the file is located in:

[Path of Solution]/.vs/[Solution Name]/v14/.suo

And for Visual Studio 2017:

[Path of Solution]/.vs/[Solution Name]/v15/.suo

Note that the .vs directory is hidden.

Option 5: Unload and Reload Project (@TTT's option)

As @TTT mentioned, try unloading the project that causes problems:

In Solution Explorer, right-click on project, Unload Project.

And re-loading it

In Solution Explorer, right-click on project, Reload Project.

Option 6: Unload and Reload Project (@Guilherme's option)

As @Guilherme mentioned, try removing and adding the reference to "Microsoft.CSharp" from the projects that have problems.

In Solution Explorer, expand the project, expand "References", right-click on "Microsoft.CSharp" and Remove.

Then, right-click on References > Add Reference, select "Microsoft.CSharp" from the list and click OK

你可能感兴趣的:(编程工具)