Adding Sub Folders to Content Folder - asp.net-mvc

I want to add folders/sub-folders/files to the content folder of MVC3 project. I added some folders with sub folders and files to the Project Directory of Contents Folder in Explorer. However, when I try to add them in visual studio, it will not let me add the folder and its sub contents, but keeps navigating to the files in those folders. Why can't I just add the folder, and its sub folders with files. It only allows adding the individual files to the Contents root folder and does not create the folder structures. I want to maintain the folder structures in the Visual Studio Project, but can not.

in VS2012 and others, make sure that you have the option "Show All Files" selected in your Solution Explorer. This will show all the content, subfolders and files in your project.
If your using any source control, ensure that you 'right click' on the folders or files you want to add and choose "include in project" from the pop-up menu.
The reverse of this also works to "exclude from project".
I ran into this issue myself, when first getting into VS, and got quite frustrated at adding content through Windows Explorer, but not being able to see that content appear in the Solution Explorer.

Related

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

SSIS Project will not show a new folder added

I created a folder called BatchFiles in TFS for an SSIS project, but the folder will not show in the solution explorer. I've also noticed that .dtproj file will not show, even if I click the "Show All Files" button on top. Is there any way to show the new folder I created in solution explorer? Also will the .dtproj file always be hidden?
Add new item directly to the project does this:
Adding an existing item option automatically dumped it in Miscellaneous Folder, that looks like this:
Seems like those existing items are not being considered as project files but as misc files when being opened from solution explorer.
This seems to be an expected behavior
Any files in the dialogue box which does not have extension such as
dtsx or config .Selecting these files will automatically place them in
Miscellaneous folder
How to Add a File to the SSIS Project Miscellaneous Folder
If the file exists on disk (physically in the folder) but does not show in the solution then it is likely that the file was checked in, but the modification to the solution was not. And for BatchFiles folder, you just add them in the source control explorer. That's why there are not the in the solution explorer.
Also will the .dtproj file always be hidden?
Seems to be so. I have also reproduced and got the same behavior like this. Sorry, not very familiar with SSIS project. But according to some tutorials in google such as this
Blog : Building your SSIS project in Azure DevOps It not appears, but we also able to build it through Azure DevOps.

Confused about adding an existing file to Team Foundation Server (TFS)

I am trying to add the file "DSTB_QB.xml" to an existing project in TFS. I added the file to an existing project from Source Control Explorer using "Add Items to Folder", but I have to check it out separately from the rest of the project. Additionally, although it appears in the "App_Data" folder (which is where I want it) in my local workspace, it does not appear under the "App_Data" folder in Solution Explorer. It is as if this file is under source control, but not part of the project. How can I make the file part of the project?
You can not add just with Source Control Explorer because you Visual Studio Project does not know why some file exist on file system (maybe this temporary file). But if you add existing file with Solution Explorer to existing project this file will be added to source control automatically.
I fixed the problem by right-clicking on the "App_Data" folder in Solution Explorer and selecting "Add->Existing Item". I'm not sure if that's what the above commenter meant, but it worked.
Now my question is: Why did I have to add the file in Source Control Explorer AND in Solution Explorer? More specifically, why wasn't adding it in Source Control Explorer sufficient?

How to add an existing project to TFS

I have a solution with 6 projects already in TFS. Each project is in its own folder.
I right clicked the solution and added a new project, so the solution XML knows about my new project.
I checked in the solution file, but the newly added project is not listed in the source control explorer, presumably because I never checked in the files.
My question is how can I check in the project and ensure that the new project files go into its own folder?
If I right click in the root of the solution and select the new project files the "Destination source control folder" is set to the root - do I need to first create a folder in TFS which matches the name of my project folder? That seems backwards.
Sounds the solution is not in source control when you add the new project. Normally the new project will be created in the solution root folder and the files will be added in source control automatically if the solution has already been in source control.
So, please open the solution root folder with Windows Explorer to check if the new project exists in the workspace (solution root folder). If the project exists, then follow below steps to add the existing project in source control.
Navigate to solution root in Source Control Explorer
Right click in Source Control Explorer and select Add items to
folder
Select the Project folder you have created, then Next
Select items to add or Excluded, then Finish
Check in the changes

Get one or more files from Source Control Explorer into TEMP folder

I am working on VFP projects, but our source control is TFS. I would like to be able to get files from TFVC and redirect them from the workspace into the TEMP folder so I can easily use a 3rd party file compare utility against them. I can do this with Vault source control. Is there a way to get a file from TFS source control and put it into the TEMP (or any other folder) without creating the project folder structure (making a new Workspace pointing to the temp folder creates the folder structure)?
There isn't the build-in feature to redirect files into other folders.
You can create a new workspace and add mappings to the corresponding folders, then switch workspace that you want and get files.
If you want the different folder structure, you can map the corresponding server folders to different folders. More information, you can refer to Optimize your workspace.
There is a ...%TMP%\TFSTemp folder concept in TFS. However it's only used for files that you view.
For example: If you view the history of a file in TFS you can view
any version you want. Simply right click on an older version and
select view from the context menu. Hover over the tab in Visual Studio
and you will see the file was downloaded to the TFSTemp folder. That
file is not check out or download to you and you are just viewing
that file.
It's not used for storing TFS version control files.

Resources