What is the quickest way to create .sln file for website? - visual-studio

I've downloaded MyWSAT to review but there is no solution or project files for Visual Studio 2012. So I've created a new solution and have attempted to Add_Existing Items to the new project, however, this won't auto add new folders so I have to manually set up all folders then add the files manually.
I just wanted to know if there is a quicker way of doing this?

Create a solution.
Create a project for the website.
Paste the files in the same folder as the project.
Go back to VS and click the "Show All Files" icon above the solution explorer and include all the files.
Assuming there isn't more configuration necessary, that should work out fine. This is exempt of connection strings, security permissions, etc. but the files are all there and should render fine.
However, this really only works well for a classic ASP website. MVC takes a lot more than that (including wiring up controllers and views) unless those files are included in these "existing files" already.

Related

Organizing project files in Visual Studio for better explorer view

I have a project in visual studio where there are several files arranged in folders (filters). Inside the project, everything is well organized, but as soon as I go to the explorer, I see that all the project files are in the same folder. How can I properly organize my project so that the repository doesn't look like a bunch of files in one folder?
I use Visual Studio 2022
I tried to manually decompose the files into folders, but when I did this, visual studio began to swear that it could not find the files
Can you share a screenshot of what you have and what you want?
I ask because there are two aspects to this.
The arrangement of projects within Solution Explorer
The arrangement of files within projects within Solution Explorer
The first can be controlled by adding solution folders. The structure is stored within the .sln file.
The second is generally a representation of the file system, depending upon your project type.
Also, make sure you're using the Solution Explorer view. Does this button appear clicked for you?
If so, you should unclick it. Solution Explorer can show you either the solution view (default, and what I refer to above) or the file system view.

Show all folders and files that are not added to the .csproj file

I have trouble finding out how to see or filter all files in the solution explorer, that are not added to the .csproj project file.
In the 'navbar' of the solution explorer, there is the option to show all files, what shows me also files that are not added to the .csproj file.
Is there a way to show or filter unadded folders or files in the solution explorer?
This would save me a lot of time. Because with every update this project gets, I have to look through the project file in the solution explorer and add every unadded folder or file by hand.
The "Show All Files" button does not appear if you are selecting the Solution itself. If you select an underlying Project, or any of the folders/files in the project, the button will display:
This button should be there in your solution. It is in my visual studio 2017
This is a case that just shouldn't happen if the project is being updated properly.
What this means is, that when someone updates the projects and adds new files, that person doesn't check-in the relevant changes to the .csproj.
As far as I know, there's no way to list all files that haven't been included.
Instead of trying to fix this problem, rather try to fix the underlying problem: files that are being added to the project, but not to the .csproj.

Rename project folder in Visual studio and Team foundation server

My Visual Studio 2013 solution has a project "Test". I can rename it in solution explorer, but I also want to rename the project folder in disk and also reflect the change in Source Control(TFS). How can I easily do this?
Thank you
#CodeCaster, Thank you. Based on your advice, I have done some quick experiment, and worked it out. First step is rename the folder name in TFS; the new folder will appear in local workspace and all contents of the folder moved to this new folder. The old folder stays there with rest content which not belong to source control. You can delete it manually.
Or
Using TFS Power Tools to rename from Explorer.
I followed those steps to preserve the version history of the files inside of TFS:
Rename/move project file (.csproj) in source control explorer in VS (alternatively, this also works from within VS Solution explorer, simply select "rename")
Rename/move project folder in source control explorer in VS
now the project should be unavailable in VS, solution also gets closed
remove project from VS
add project (new path) to VS
fix project references in other projects
adjust namespaces if desired
adjust assembly name and default namespace in project settings
Don't know of an easier way. Was searching for this myself, and this should be the way to go.
I think you can rename it from the TFS Database.
Try going into tbl_Project of the Tfs_DefaultCollection Database, which you can find on the SQL Server Instance used by tfs. You can know which one is that by going into the TFS Console, click on Application Tier, then find the details of the Server under the Data Tier Summary. Run an update query against the project you want to rename.. I haven't tested this but just assuming it should work (some educated guess)..
I am using TFS 2015 Express and rename project is grayed out.
You can still rename the project using the TFS Site for the project.
Here is a link that shows how to do it.
https://www.visualstudio.com/en-us/docs/setup-admin/rename-team-project
I was facing a similar issue while trying to rename a folder in Visual Studio 2015.This is what I tried.
Right click on the project file
Open with Notepad
This will generate your current solution file
Change the occurences of your prev file name. (Find and Replace with the desired name)
Save it and close
Change solution explorer name and rename the folder to your desired name.
This should work.

Getting Team Foundation to recognize new files added to source controlled directory

I am working on a PHP project, so I am not using Visual Studio, however the company I work at is mostly a .NET shop so we use Team Foundation Server for version control. I can use VS to manually add files to the TFS project but that is a bit cumbersome when I am adding a bunch of new files, I pretty much have to add the file right after I create it so I don't forget.
What I want to know is if there is a way to have TFS pick up a new file added to a directory that is under source control for a project. For instance if I added a few PHP files to the source controlled html directory I would like to be able to just go to check in pending changes in TFS and have the newly added files included in the list. Does anyone know if this is possible? Thanks much!
There's no way to have this happen automatically with TFS 2010 or below. I've seen a video that says they'll be adding this feature for the next release.
In the meantime, you can use Source Control Explorer, then right-click a folder in the left pane and choose "Add Items to Folder". Follow the dialog and you'll be able to add any of the items that haven't previously been added.

Visual Studio: Create a web application from existing code

I have an existing directory structure that is all nicely checked into SVN, so I don't really want to mess with it.
The website code lives in a folder called C:\Projects\TheProject\Website. I want to bring the website files into a new Web Application Project without changing the directory structure.
Ideally the resulting file structure would look like this:
C:\Projects\TheProject\TheProject.sln
C:\Projects\TheProjects\Website\Website.csproj
No matter what I try I dont get what I want. There is no option to create a web application from existing code. This is very frustrating. Does anyone know if it is possible?
OK I figured it out. It's weird, but the following steps will work:
Open fresh copy of Visual Studio
File->New Project, select Web Application
Use the following settings:
Name: Website (this is the name of the existing folder with the website files in it)
Location: C:\Temp\ (anywhere will do for now)
Solution Name: TheProject (name of the existing project's root folder)
Check "Create directory for solution"
Delete the auto-created Default, Global and Web.config files
Save All and close Visual Studio
In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.
Double click on the sln file to open Visual Studio again.
Select "Show all files" (at the top of Solution Explorer)
Right click on any files or folders you want to add and select Include in Project.
Have you tried something like this?
Create a new Visual Studio Blank Solution from File-->New Project-->Other Project Types-->Blank Solution, making sure to specify c:\Projects\TheProject as your solution directory.
Copy the folder with all of the existing website stuff into c:\Projects\TheProject\WebSite.
Back in Visual Studio, right-click your solution in Solution Explorer and select "Add Existing Website." Then, pick your c:\Projects\TheProject\WebSite folder.
Good luck, HTH.
Create a new web project with a .csproj file. Delete all the files it comes with. Drag everything into the project.
In the File menu, click Open, and then click Web Site. Choose the root folder where your Web Site is located
On top of #cbp answer I would like to add that if you would like to keep the Version control history of those files - in step 6 - instead of copy do:
git mv original-website/* new-web-application-directory/.
What have you tried? I normally create a blank solution and add existing folders (drag and drop on solution explorer works best), and have not had a problem.
in VS 2008 File->New->Project From Existing Code

Resources