最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - ASP.Net Visual Studio IntelliSense and Symbol Recognition Problem - Stack Overflow

programmeradmin1浏览0评论

(.png) (.png)

I am experiencing an unusual issue with one of my projects in Visual Studio. This problem does not occur in any of my other projects. The project in question is an ASP.NET MVC 5 project written in C# and targets .NET Framework 4.5.2 (I recently upgraded it to .NET Framework 4.6 in an attempt to resolve the issue, but this didn't help).

In the .csproj file, the ProjectTypeGuids property is set to the following value:

{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}

Issue Description

When I create a new class in the Solution Explorer, Visual Studio does not recognize my custom class names inside this newly created file. Instead of displaying them in light blue as expected, they remain black.

Furthermore, when I right-click on these class names and select "Go To Definition", I receive the following error:

Cannot navigate to the symbol under the caret

Additionally, if I use a non-existent class name in this new file, Visual Studio does not underline it in red (as it normally should) to indicate an error.

The compiler does not immediately show any errors, but the errors do appear in the Output window when I build the project.

In these new class files, the using directives are also displayed in black, even if they are unused. Normally, they should appear in grey if they are unused.

Temporary Solution / Workaround

If I close and reopen Visual Studio after creating a new class, all these issues disappear for that particular file. However, if I create another new class, the problem returns until I restart Visual Studio again.

Interestingly, if I add a Web Form to the project instead of a class, Visual Studio starts recognizing my custom class names properly. However, even in this case, non-existent classes are still not underlined in red.

Observation

I noticed that when I create a new class in my other projects, there’s usually a small expand/collapse arrow on the left side of the class name in Solution Explorer. However, in this problematic project, this arrow does not appear until I restart Visual Studio.

Important Note

When I first received this project, there was no "Class" item in the Add New Item templates under the Item Templates section. I manually added several framework references, libraries, and Visual Studio tools to restore the template. This might be relevant to the issue.

Steps I've Tried (Unsuccessful):

-Rebuild, build, and clean the project

-Disabling all Visual Studio extensions

-Updating Visual Studio to the latest version

-Unloading and reloading the project

-Testing the project on Visual Studio 2019 Community and Visual Studio 2022 Preview

-Disabling CodeLens

-Disabling IntelliSense entirely

-Enabling Run on Build in the project's Code Analysis settings

-Upgrading the project's target framework to .NET Framework 4.8

-Adding <PlatformTarget>AnyCPU</PlatformTarget> to the .csproj file

-Deleting the obj and bin folders

-Clearing Visual Studio caches:

%LocalAppData%\Microsoft\VisualStudio\17.0_ea9370b3\ComponentModelCache

%LocalAppData%\Microsoft\VisualStudio\17.0_ea9370b3\ProjectTemplatesCache

%LocalAppData%\Microsoft\VisualStudio\17.0_ea9370b3\ItemTemplatesCache

%LocalAppData%\Microsoft\VisualStudio\Roslyn\Cache

-Enabling the following options in Visual Studio:

"Tools\Options\Text Editor\C#\Advanced\Run background code analysis for Entire Solution"

"Tools\Options\Text Editor\C#\Advanced\Show compiler errors and warnings for Entire Solution"

-Resetting Visual Studio settings via Tools -> Import and Export Settings -> Reset all settings

-Running the following command in Developer Command Prompt for VS 2022:

devenv.exe /InstallVSTemplates

-Deleting the .vs folders

-Adding <RestoreProjectStyle>PackageReference</RestoreProjectStyle> to the .csproj file

-Restarting and PowerOff/PowerOn my computer

Key Details from .csproj File Top Section:

    <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns=";>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
  <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')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>
    </ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{C588411D-0399-4AA1-802F-26A29126CEDF}</ProjectGuid>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>isTakip</RootNamespace>
    <AssemblyName>isTakip</AssemblyName>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <UseIISExpress>true</UseIISExpress>
    <IISExpressSSLPort />
    <IISExpressAnonymousAuthentication />
    <IISExpressWindowsAuthentication />
    <IISExpressUseClassicPipelineMode />
    <UseGlobalApplicationHostFile />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
    <TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>
    <Use64BitIISExpress />
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
  </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
  </PropertyGroup>
</Project>

Key Details from .csproj File Bottom Section:

    <PropertyGroup>
      <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">
        10.0
      </VisualStudioVersion>
      <VSToolsPath Condition="'$(VSToolsPath)' == ''">
    $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
      </VSToolsPath>
    </PropertyGroup>
    <PropertyGroup>
      <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    </PropertyGroup>
    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    <Import 
    Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\
         v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets"
    Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\
           v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')"
    />
    <Import 
    Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" 
    Condition="'$(VSToolsPath)' != ''" 
    />
    <Import 
    Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\
         WebApplications\Microsoft.WebApplication.targets" 
    Condition="false" 
    />
    <ProjectExtensions>
      <VisualStudio>
        <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
          <WebProjectProperties>
            <UseIIS>True</UseIIS>
            <AutoAssignPort>True</AutoAssignPort>
            <DevelopmentServerPort>5928</DevelopmentServerPort>
            <DevelopmentServerVPath>/</DevelopmentServerVPath>
            <IISUrl>http://localhost:5928/</IISUrl>
            <NTLMAuthentication>False</NTLMAuthentication>
            <UseCustomServer>False</UseCustomServer>
            <CustomServerUrl>
            </CustomServerUrl>
            <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
          </WebProjectProperties>
        </FlavorProperties>
        <UserProperties plugins_4pdfmake_4pdfmake_1js_1map__JsonSchema="" />
      </VisualStudio>
    </ProjectExtensions>
    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
      <PropertyGroup>
        <ErrorText>
        This project references NuGet package(s) that are missing on this computer
        Use NuGet Package Restore to download them.
        For more information, see /?LinkID=322105. 
        The missing file is {0}.
    </ErrorText>
      </PropertyGroup>
      <Error 
    Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0
                    \build\Microsoft.Net.Compilers.props')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
        \Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" 
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build
            \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build
           \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" 
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.ApplicationInsights.DependencyCollector.2.9.0\build
            \Microsoft.ApplicationInsights.DependencyCollector.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
         \Microsoft.ApplicationInsights.DependencyCollector.2.9.0\build
         \Microsoft.ApplicationInsights.DependencyCollector.targets'))" 
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.ApplicationInsights.PerfCounterCollector.2.9.0\build
            \Microsoft.ApplicationInsights.PerfCounterCollector.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
        \Microsoft.ApplicationInsights.PerfCounterCollector.2.9.0\build
        \Microsoft.ApplicationInsights.PerfCounterCollector.targets'))" 
    />
      <Error 
    Condition="!Exists('..\packages
         \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.9.0
         \build
         \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.targets
         ')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.9.0
           \build
           \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.targets
           '))"
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.ApplicationInsights.WindowsServer.2.9.0\build
            \Microsoft.ApplicationInsights.WindowsServer.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.ApplicationInsights.WindowsServer.2.9.0\build
           \Microsoft.ApplicationInsights.WindowsServer.targets'))" 
    />
      <Error 
    Condition="!Exists('..\packages\Microsoft.ApplicationInsights.Web.2.9.0
            \build\Microsoft.ApplicationInsights.Web.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.ApplicationInsights.Web.2.9.0\build
           \Microsoft.ApplicationInsights.Web.targets'))" 
    />
    </Target>

Content SLN File:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isTakip",
"isTakip\isTakip.csproj", "{C588411D-0399-4AA1-802F-26A29126CEDF}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C588411D-0399-4AA1-802F-26A29126CEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C588411D-0399-4AA1-802F-26A29126CEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C588411D-0399-4AA1-802F-26A29126CEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C588411D-0399-4AA1-802F-26A29126CEDF}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

Questions

What might be causing this issue?

The links at the top are "Project Properties Application Page" and "Project Properties Build Page" screens.

I have looked at many similar questions on the forum but none are exactly the same.I would greatly appreciate any insights or suggestions you may have. Thanks in advance!

(https://i.sstatic/gwpy5b6I.png) (https://i.sstatic/AjNqkJ8J.png)

I am experiencing an unusual issue with one of my projects in Visual Studio. This problem does not occur in any of my other projects. The project in question is an ASP.NET MVC 5 project written in C# and targets .NET Framework 4.5.2 (I recently upgraded it to .NET Framework 4.6 in an attempt to resolve the issue, but this didn't help).

In the .csproj file, the ProjectTypeGuids property is set to the following value:

{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}

Issue Description

When I create a new class in the Solution Explorer, Visual Studio does not recognize my custom class names inside this newly created file. Instead of displaying them in light blue as expected, they remain black.

Furthermore, when I right-click on these class names and select "Go To Definition", I receive the following error:

Cannot navigate to the symbol under the caret

Additionally, if I use a non-existent class name in this new file, Visual Studio does not underline it in red (as it normally should) to indicate an error.

The compiler does not immediately show any errors, but the errors do appear in the Output window when I build the project.

In these new class files, the using directives are also displayed in black, even if they are unused. Normally, they should appear in grey if they are unused.

Temporary Solution / Workaround

If I close and reopen Visual Studio after creating a new class, all these issues disappear for that particular file. However, if I create another new class, the problem returns until I restart Visual Studio again.

Interestingly, if I add a Web Form to the project instead of a class, Visual Studio starts recognizing my custom class names properly. However, even in this case, non-existent classes are still not underlined in red.

Observation

I noticed that when I create a new class in my other projects, there’s usually a small expand/collapse arrow on the left side of the class name in Solution Explorer. However, in this problematic project, this arrow does not appear until I restart Visual Studio.

Important Note

When I first received this project, there was no "Class" item in the Add New Item templates under the Item Templates section. I manually added several framework references, libraries, and Visual Studio tools to restore the template. This might be relevant to the issue.

Steps I've Tried (Unsuccessful):

-Rebuild, build, and clean the project

-Disabling all Visual Studio extensions

-Updating Visual Studio to the latest version

-Unloading and reloading the project

-Testing the project on Visual Studio 2019 Community and Visual Studio 2022 Preview

-Disabling CodeLens

-Disabling IntelliSense entirely

-Enabling Run on Build in the project's Code Analysis settings

-Upgrading the project's target framework to .NET Framework 4.8

-Adding <PlatformTarget>AnyCPU</PlatformTarget> to the .csproj file

-Deleting the obj and bin folders

-Clearing Visual Studio caches:

%LocalAppData%\Microsoft\VisualStudio\17.0_ea9370b3\ComponentModelCache

%LocalAppData%\Microsoft\VisualStudio\17.0_ea9370b3\ProjectTemplatesCache

%LocalAppData%\Microsoft\VisualStudio\17.0_ea9370b3\ItemTemplatesCache

%LocalAppData%\Microsoft\VisualStudio\Roslyn\Cache

-Enabling the following options in Visual Studio:

"Tools\Options\Text Editor\C#\Advanced\Run background code analysis for Entire Solution"

"Tools\Options\Text Editor\C#\Advanced\Show compiler errors and warnings for Entire Solution"

-Resetting Visual Studio settings via Tools -> Import and Export Settings -> Reset all settings

-Running the following command in Developer Command Prompt for VS 2022:

devenv.exe /InstallVSTemplates

-Deleting the .vs folders

-Adding <RestoreProjectStyle>PackageReference</RestoreProjectStyle> to the .csproj file

-Restarting and PowerOff/PowerOn my computer

Key Details from .csproj File Top Section:

    <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
  <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')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>
    </ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{C588411D-0399-4AA1-802F-26A29126CEDF}</ProjectGuid>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>isTakip</RootNamespace>
    <AssemblyName>isTakip</AssemblyName>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <UseIISExpress>true</UseIISExpress>
    <IISExpressSSLPort />
    <IISExpressAnonymousAuthentication />
    <IISExpressWindowsAuthentication />
    <IISExpressUseClassicPipelineMode />
    <UseGlobalApplicationHostFile />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
    <TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>
    <Use64BitIISExpress />
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
  </PropertyGroup>
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
  </PropertyGroup>
</Project>

Key Details from .csproj File Bottom Section:

    <PropertyGroup>
      <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">
        10.0
      </VisualStudioVersion>
      <VSToolsPath Condition="'$(VSToolsPath)' == ''">
    $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
      </VSToolsPath>
    </PropertyGroup>
    <PropertyGroup>
      <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    </PropertyGroup>
    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    <Import 
    Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\
         v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets"
    Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\
           v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')"
    />
    <Import 
    Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" 
    Condition="'$(VSToolsPath)' != ''" 
    />
    <Import 
    Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\
         WebApplications\Microsoft.WebApplication.targets" 
    Condition="false" 
    />
    <ProjectExtensions>
      <VisualStudio>
        <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
          <WebProjectProperties>
            <UseIIS>True</UseIIS>
            <AutoAssignPort>True</AutoAssignPort>
            <DevelopmentServerPort>5928</DevelopmentServerPort>
            <DevelopmentServerVPath>/</DevelopmentServerVPath>
            <IISUrl>http://localhost:5928/</IISUrl>
            <NTLMAuthentication>False</NTLMAuthentication>
            <UseCustomServer>False</UseCustomServer>
            <CustomServerUrl>
            </CustomServerUrl>
            <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
          </WebProjectProperties>
        </FlavorProperties>
        <UserProperties plugins_4pdfmake_4pdfmake_1js_1map__JsonSchema="" />
      </VisualStudio>
    </ProjectExtensions>
    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
      <PropertyGroup>
        <ErrorText>
        This project references NuGet package(s) that are missing on this computer
        Use NuGet Package Restore to download them.
        For more information, see http://go.microsoft/fwlink/?LinkID=322105. 
        The missing file is {0}.
    </ErrorText>
      </PropertyGroup>
      <Error 
    Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0
                    \build\Microsoft.Net.Compilers.props')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
        \Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" 
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build
            \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build
           \Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" 
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.ApplicationInsights.DependencyCollector.2.9.0\build
            \Microsoft.ApplicationInsights.DependencyCollector.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
         \Microsoft.ApplicationInsights.DependencyCollector.2.9.0\build
         \Microsoft.ApplicationInsights.DependencyCollector.targets'))" 
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.ApplicationInsights.PerfCounterCollector.2.9.0\build
            \Microsoft.ApplicationInsights.PerfCounterCollector.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
        \Microsoft.ApplicationInsights.PerfCounterCollector.2.9.0\build
        \Microsoft.ApplicationInsights.PerfCounterCollector.targets'))" 
    />
      <Error 
    Condition="!Exists('..\packages
         \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.9.0
         \build
         \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.targets
         ')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.9.0
           \build
           \Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.targets
           '))"
    />
      <Error 
    Condition="!Exists('..\packages
            \Microsoft.ApplicationInsights.WindowsServer.2.9.0\build
            \Microsoft.ApplicationInsights.WindowsServer.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.ApplicationInsights.WindowsServer.2.9.0\build
           \Microsoft.ApplicationInsights.WindowsServer.targets'))" 
    />
      <Error 
    Condition="!Exists('..\packages\Microsoft.ApplicationInsights.Web.2.9.0
            \build\Microsoft.ApplicationInsights.Web.targets')" 
    Text="$([System.String]::Format('$(ErrorText)', '..\packages
           \Microsoft.ApplicationInsights.Web.2.9.0\build
           \Microsoft.ApplicationInsights.Web.targets'))" 
    />
    </Target>

Content SLN File:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "isTakip",
"isTakip\isTakip.csproj", "{C588411D-0399-4AA1-802F-26A29126CEDF}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C588411D-0399-4AA1-802F-26A29126CEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C588411D-0399-4AA1-802F-26A29126CEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C588411D-0399-4AA1-802F-26A29126CEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C588411D-0399-4AA1-802F-26A29126CEDF}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

Questions

What might be causing this issue?

The links at the top are "Project Properties Application Page" and "Project Properties Build Page" screens.

I have looked at many similar questions on the forum but none are exactly the same.I would greatly appreciate any insights or suggestions you may have. Thanks in advance!

Share Improve this question edited Mar 14 at 1:33 Jack J Jun 6,0061 gold badge13 silver badges44 bronze badges asked Mar 13 at 10:51 MelihMelih 13 bronze badges 4
  • I've seen a elements of a file in VS not have the right "color" in the IDE and I've had chunks of code that should be collapsible not have the "+/-" icons or the side/down caret to expand or collapse. This has usually been after a solution has been open for a LONG time (days, maybe weeks!). So I've close the VS instance and reopened, and this has "fixed" the issue for good. Have you looked at the Build Action Property of the file(s) in question? Is your VS instance not setting that as expected for new class files, etc.? – Jeff Zola Commented Mar 13 at 16:14
  • Please try to compare properties of working class with unrecognized class. Specifically, "Build Action". Besides, please check if you enable show error squiggles via Tools-Options->Text Editor->General. – Dou Xu-MSFT Commented Mar 14 at 7:21
  • @JeffZola The Build Action property of the relevant files appears as "Compile". So there is no problem in that section. Can you say close and reopen VS Instance ? I don't know mean VS Instance. If you mention Alt+F4, I did this. – Melih Commented Mar 14 at 8:59
  • @DouXu-MSFT show error squiggles property is enabled. I compared properties of working class with unrecognized class but I didn't see difference. Build Action properties is compile both of them. – Melih Commented Mar 14 at 9:04
Add a comment  | 

1 Answer 1

Reset to default 0

I found a temporary solution for this problem without reopen Visual Studio.

After creating the class, I have to press SaveAll button and I have to change Active Solution Configuration (If Debug than Release, if release than debug). Afterwards classes begin to be detected.

However, this action must be performed after each new class is created.

When I clicked the SaveAll button, I observed that it saved the code <Compile Include="Class1.cs" /> between the ItemGroup tags in the csproj file. I know this. But other projects don't need this action. It starts detecting the class as soon as you create it in other projects.

---Edited

Problem was solved when I deleted the following lines from the .csproj file

<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')" />

发布评论

评论列表(0)

  1. 暂无评论