Visual Studio - project shows up as “Miscellaneous Files”

后端 未结 13 1843
走了就别回头了
走了就别回头了 2020-12-01 11:50

This is a weird one. I have a C# Class Library project within my solution. If I open a .cs file within this project, the Project drop-down on the c

相关标签:
13条回答
  • 2020-12-01 12:29

    How I solved my issue:

    1. Go to the file which appears as Miscellaneous Files inside Solution Explorer.
    2. Right-Click file and select Exclude from project.
    3. Right-Click your project/folder where the file was and click add Existing Item, and add the file you just removed back into your project.
    0 讨论(0)
  • 2020-12-01 12:30

    After trying all the other offered solution, what worked for me is:

    • Editing the .gitattributes file.
    • adding *.xproj text eol=crlf

    So that my VS2015 xproj style .NET Core/Standard projects worked again.

    Turned out that my git was putting UNIX style EOL, which was confusing VS.

    0 讨论(0)
  • 2020-12-01 12:33

    Check that link https://www.reddit.com/r/VisualStudio/comments/b8vbj8/help_netf461_project_opened_in_vs2019_all_files/

    1. Right click on "References" in the Solution Explorer
    2. Select "Manage NuGet Packages"
    3. Under the "Installed" tab search fro "Microsoft.Net.Compilers"
    4. Select "Microsoft.Net.Compilers"
    5. On the side window of "Microsoft.Net.Compilers" click the update button

      • VS2015 is compatible with .NET Compiler 1.x.x
      • VS2017 is compatible with .NET Compiler 2.x.x
      • VS2019 is compatible with .NET Compiler 3.x.x

    So, just update Microsoft.Net.Compilers according to you vs's version

    0 讨论(0)
  • 2020-12-01 12:37

    Here is the Solution:

    • Go to Options on the Tools menu and then select Documents in the Environment node. (If Documents does not appear in the list, select Show all settings in the Options dialog box.)
    • Put a tick on "Miscellaneous files in Solution Explorer" and Click OK. (This option displays the "Miscellaneous Files" node in Solution Explorer. Miscellaneous files are files that are not associated with a project or solution but can appear in Solution Explorer for your convenience if you tick this option.)
    • Locate your file in the Solution Explorer under "Miscellaneous Files". Then drag and drop your file to where it should belong and voila! This will copy the file to where you drop it. You may now safely delete the older file under Miscellaneous Files folder if you wish to do so.
    0 讨论(0)
  • 2020-12-01 12:42

    I had this problem in VS2019 after upgrade from 2017. Clean and rebuild of solution fixed it.

    1. Build -> Batch build -> Select all -> Clean
    2. Build -> Batch build -> Select all -> Build
    0 讨论(0)
  • 2020-12-01 12:45

    If it's not showing up in your Solution Explorer, try clicking the "Show All Files" button at the top of Solution Explorer. If the files become visible and are located under the project you expect them to be in, but the file still has "Miscellaneous" listed as its project, then right click the files and select "Include in Project". Otherwise try dragging them to the proper project.

    I just hit this issue in VS 2017 and this is what worked for me.

    0 讨论(0)
提交回复
热议问题