Reputation: 2357
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 code editor shows that it belongs to 'Miscellaneous Files'.
Other symptoms: if I go to the properties of the project and look at Assembly Information
, all values are blank, despite the values existing in the AssemblyInfo.cs
file.
Both of these are annoying, but the problem is that
I have tried:
.csproj
file and comparing to others in the solution (no joy).csproj
file and overwriting the old one (worked until I merged the branch into trunk, then the problem re-appeared)Google has turned up nothing. Does anyone have any ideas as to what's going on here?
Upvotes: 51
Views: 86328
Reputation: 251
I've had this problem and it was a user error. Turns out I had multiple copies of the code on my machine and was running a version under project2 while having project1 open in VS. So the debugger worked but loaded version under project2 and confused the heck out of me.
TLDR; Make sure the version running is from the same folders/files you have open in VS.
Upvotes: 0
Reputation: 331
Here is the Solution:
Upvotes: 23
Reputation: 1370
You might need to increase the Windows filepath length, to allow it greater than 256 characters for filepaths.
In my case, the several files were very deep in folders and caused the long filepaths issue. Search online how to increase it (via Registry & regedit). You'll have to restart PC afterwards.
Upvotes: 0
Reputation: 1
If you not have compiler package miscellaneous files will created when build solution. So, Check nuget package Microsoft.Net.Compilers is installed or not. Install if not, or do update on that package. I did this and my issue solved.
Upvotes: 0
Reputation: 21
This Worked for me:
Upvotes: 2
Reputation: 362
perhaps after some refactoring,you have modified the name of the project under TFS and Rename the project using the Solution Explorer (i.e. right click the project and click rename) which does not match this project name on source Control Explorer. in this way you will see "Miscellaneous Files" in the Solution Explorer that are not associated with TFS,The Miscellaneous Files folder represents the files as links. for more detail My Response have been written here
Upvotes: 0
Reputation: 403
I had this issue in VS 2019 Community with a class file and KING's solution of excluding the file and re-adding it didn't work for me. I was able to fix the issue by
Upvotes: 1
Reputation: 426
When you add a new file in a project, some times visual studio adds it in your project.csproj in <itemGroup>
as <Compile Remove>
so that file will not be compiled and will not be copied with the build files. This is usefull for node_module files for example
<ItemGroup>
<Compile Remove="Controllers\StockController.cs" />
</ItemGroup>
you only open your *.csproj and delete it from.
Upvotes: 1
Reputation: 31
I had this problem in VS2019 after upgrade from 2017. Clean and rebuild of solution fixed it.
Upvotes: 3
Reputation: 1
Somehow I solved this by going to properties (Right-click the file and select Properties). The Build Action was set to Content. Just change it to Compile and problem solved.
Upvotes: 0
Reputation: 1
If this is still an issue you might check through your Nuget packages. By default in VS 2017 some projects would include references to various compiler libraries from Microsoft. These almost certainly aren't needed. In my case removing them immediately resolved the miscellaneous files issue.
I can't recall which Nugets exactly but I am pretty sure one of them was - Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 151
Check that link https://www.reddit.com/r/VisualStudio/comments/b8vbj8/help_netf461_project_opened_in_vs2019_all_files/
On the side window of "Microsoft.Net.Compilers" click the update button
So, just update Microsoft.Net.Compilers according to you vs's version
Upvotes: 13
Reputation: 980
How I solved my issue:
Upvotes: 49
Reputation: 493
maybe you can only open the error project in another solution and add the project you need in the new solution
Upvotes: -1
Reputation: 4026
After trying all the other offered solution, what worked for me is:
.gitattributes
file.*.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.
Upvotes: 0
Reputation: 91
In VS2017, I was able to fix this issue by deleting *.vs folder and *.user files
Upvotes: 9
Reputation: 2564
Due to TypeScript, check that your file matches to pattern, specified in tsconfig.json file in "include" section. If .ts file not inculded by tsconfig, then intellicense will show it as Miscellaneous.
Upvotes: 0
Reputation: 473
I have this issue in VS 2017 also.
I found that this miscellaneous
files are files added outside the VS. So if switch to another git branch (where there are new files) whithout closing the VS and click to "Reload" button in VS (when it checks that sln/csproj files are modified outside the VS) then these new files are not correctly parsed by VS and "marked" as miscellaneous
.
As workaround I close VS, remove folder .vs
from disk and run VS again. After VS will fully initialized these new files are parsed successfully.
Note this way clears you custom settings like StartUp Project
and so on.
Upvotes: 27
Reputation: 1499
I had exactly the same problem and it turned out that some of the XAML files in my project were set to be built using the action 'XamlAppDef' (ie build it as a XAML Workflow) and when I turned it back to 'Compile', my Project dropdown instantly went from (Miscellaneous files) to the correct project.
Upvotes: 4