I've done all things above but my problem did not solve (trying to open project by VS 2017),
after that I realized that the problem was my csproj file. My project (mvc)
was created by VS 2015... So I edit my csproj file and replace
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
by this :
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.7\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.7\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
It was all about the version of DotNetCompilerPlatform.
(the way that I understood this issue was that I created new mvc project by
VS 2017 and compared both csproj files - the new one and the one that created by VS 2015 - )
Additional related info by https://stackoverflow.com/users/15667/xan (since answers are locked)
For me (VS2019 opening an older solution) it was only affecting one project in the solution. The Imports looked like this:
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
The working projects only had the
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
line, so I removed the first 2 and intelisense / go to definition etc. started working again.
HOWEVER the web project now wouldn't run due to missing Roslyn csc compiler.
In the end the solution that worked overall was to update the Microsoft.CodeDom.Providers.DotNetCompilerPlatform
and Microsoft.Net.Compilers
Nuget packages for the project.