Visual studio 2019 Community v 16.11.11 does not remember included folder - visual-studio-2019

I have a project where I have a folder name JS. Each time I open the solution I see the folder is not included in the solution explorer. I have to use the Show all files and include the JS folder and add the existing items. It works again. If I close the solution I get the same problem. I have not changed any setting in VS, what is wrong here?

Related

Adding Javascript file to MVC Project in VS 2022

I have migrated my project from VS 2017 to VS 2022,
And I have a strange problem:
When attempting to add a new .JS file to the scripts folder
I don't have the option to select .JS file in the "Add New Item" menu (via right-click on scripts folder), only .TS or .JSON:
Tried "playing" with it and searching but did not find any solution.
can someone please tell me what am I missing?
This depends on one thing that is if you installed all required modules for Visual Studio 2022.
The basic thing here is to Right-Click on any directory/folder in the Solution Explorer window, Select Add and then New Item. You then click on the Language you are programming in. Note: if you don't click this folder, the options you may see would be only for the selected folder.
See below images...

Move Project To a New Folder in Visual Studio

Here is my Solution files structure (folders are prefixed by +):
+FooProject
FooProject.sln
+Tests
+BarTests
BarTests.csproj
Now I want to move the BarTests project to a new subfolder UnitTests:
+FooProject
FooProject.sln
+Tests
+UnitTests
+BarTests
BarTests.csproj
I tried the following ways but to no avail:
If I add a New Solution Folder, UnitTests, in Visual Studio, and move the BarTests to UnitTests folder in Visual Studio, then no new folder is created on disk, and no changes to the solution file are made, hence can't propagate this change in the source control.
I create the UnitTests folder directly on disk (using File Explorer or Command Line), move the BarTests to UnitTests, and then manually update the solution file to reflect this change in the path. Now the problem is in Visual Studio, I still see the BarTests project under the 'Tests' folder and not the UnitTests folder.
I tried the second approach even after closing VS and deleting the .vs folder but still the same behavior.
What am I missing here?
Solution folders within Visual Studio are just used to organise solution-level assets such as projects and other solution folders within Visual Studio itself and are not permeated to disk.
When you move a folder on disk and change the reference to it within the .sln file, you are doing exactly that.
Really simple solution, do exactly what you have tried already and you can even do it within Visual Studio by switching to "Folder View" within the Solution Explorer.
Unload or remove the BarTests project from the solution within Visual Studio.
Create your physical "UnitTests" target folder on disk in the desired location and move the BarTests project folder and files to the target location.
Return to Visual Studio and repeat, create your solution folder for UnitTests and then add your project to that solution folder (if you removed then you select "Add existing project" from the menu).

All the project files showing as Miscellaneous Files. Visual Studio 2017

I moved my Asp.net-mvc project from desktop to F drive and all the files are showing as miscellaneous files.
I've tried running the visual studio installer and modify to make sure that "Nuget targets and build tasks" are ticked.
I've also tried :
excluding the file
add existing member(adding the file again)
but nothing's working.
Same thing happened with my asp.net core web api when I moved it, it's working fine tho, getting data from server.
Hope you will solve your problem
Solution 1:
Create new project then paste all project contents in new created project.Restore Nuget packages then Build it.
Solution 2 :
Go to the file which are Miscellaneous inside Solution Explorer.
Right click those file'(s) and select Exclude from project.
Add Existing Item to project, you just excluded.
Probably your file property configuration is wrong.
Try this:
Right click over the File that has this problem
Click on Properties
Under Advanced -> Build Action, check if other than "Compile" is selected.
If so, change it to "Compile".
Properties Window

Excluded files from tfs still being checked in

I'm currently working on a WiX project and I need to include some files in my project but exclude them from tfs. I need to do this because these files are auto-generated at compile time but they have to be part of the project to be compiled. I thought that I could exclude them from source control by going to File->Source Control->Advanced->Exclude <file> From Source Control but it still seems to be including it in TFS.
Below is a picture of my project and it appears that visual studio is trying to exclude them from tfs judging by the little red icon next to the files I'm excluding. However when I compile it errors out because the excluded files are read only and I can clearly see them checked in by looking at the source control explorer window.
Is this an issue in visual studio or am I doing something wrong here?
I resolved this by closing out my solution and deleting the files in source control explorer. Before when I was deleting them from source control explorer I had my solution open and it was actually removing them from the project file. Seems like when you exclude them from source control via the method described above it should remove them from source control but it doesn't.

Can't manually add files to TFS

We use Codesmith to generate some code, and when we open up the projects, the files are there, in the solution, but there is no way to check them in. The DLL compiles just fine. The only difference to the .csproj is the addition of any new files we generated.
But unlike VSS, TFS, does not detect these files. I validated this behavior by editing the .csproj manually. For some reason, the only way to add a file to TFS is through Visual Studio.
However, when I remove them from the project, and then include them, I get the usual yellow plus sign.
You can manually add files to Visual Studio, however changing your project file isn't the best way to do this. If your project is already under source control and the files you want to add are visible in the Solution Explorer window, you can simply right-click a file and select Include in project. The next time you check your code in, the items will be added.
Since you're using TFS 2010, check out the Team Foundation Server Power Tools extensions. This includes the Windows Shell Extensions which give you integration into Windows Explorer which let's you right click on files or folders and add the to TFS outside of Visual Studio. Very nifty!
Looks like it is not possible and the workaround is to batch-add all the files through PowerTools. Though this article/forum-thread is dated it appears to be helpful:
Adding CodeSmith generated source file in Team Foundation System

Resources