Adding Javascript file to MVC Project in VS 2022 - asp.net-mvc

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...

Related

Visual studio 2019 Community v 16.11.11 does not remember included folder

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?

Visual Studio 2019 : Double clicking a project in Solution Explorer opens the .csproj file instead of toggling project files visibility

Double-clicking a project used to toggle visibility of its files, but now it opens the csproj file.
This is different than the behavior we’ve had in VS for years. It’s not very often that you have to edit the csproj file. Is there any option or tweak to get the toggling behavior back like it was before ?
As to #Hans Passant answer :
« Use Tools > Options > Projects and Solutions > General, untick "Open SDK-style project files..." to restore the old behavior. »
Now the option is named as:
Open project files with double click or the enter key when supported

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

VS 2019 - How to choose location for Add new project

For a VS 2017 solution, when you right click on solution and choose add new project, in the templates page there is an option to choose the destination folder (if different from the solution folder), however it does not seem to be an option in VS 2019 preview. Is there anyway to have that option show up ? (is it even an option in 2019 ?)
To clarify - this is when you already have a solution open and are trying to add a new project to that solution
Apparently, it was an issue with Resharper as well which messed up the new project dialog windows. Once that patch was installed everything worked as expected throughout. Odd issue and an even more odd fix.
https://youtrack.jetbrains.com/issue/RSRP-473453
I have VS2019 preview installed.
From the start page select 'Create a new project', then select a project type. For example 'Class Library (.net Core)and press the next button. The next screen will present you with textboxes forProject name,location,solution name` and an option to place the solution and project in the same directory

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