projects disappear from VS 2015 solution after reopening - c#

I have a weird problem with my C# solution file. I noticed that my .sln file itself was missing. So I created an empty .sln file, added my Existing projects to it, built and it worked fine. When I close and reopen Visual Studio, the .sln file I created is there but projects added to the solution have disappeared. How to fix this?

It sounds like you are having issues with write permissions in your solution. Is the folder your solution is in under any type of source control?
Try creating a new folder at the root of your harddrive. Something like c:\testsolution
Copy your project files there and then try adding you solution file again.
Good luck.

Most likely this is an issue with not saving the changes to VS solution file.
Before closing Visual Studio, take an extra step to make sure all changes are actually saved (File-> Save All). Then manually verify that all your projects successfully made it to the solution file by opening the solution file with a text editor. If you don't see your projects listed, try editing the file yourself to verify you have the necessary permissions.

Related

Could not find file 'bin\Antlr3.Runtime.pdb' Error when creating deployment package

I'm getting the following error when tried to create deployment package.
"Copying file bin\Antlr3.Runtime.pdb to obj\Release\AspnetCompileMerge\Source\bin\Antlr3.Runtime.pdb failed. Could not find file 'bin\Antlr3.Runtime.pdb'"
Can someone tell me what is happening and how to solve it
First of all delete whole file from bin folder
Remove reference of this "Antlr3"
Close Visual Studio
Open .croj project file in Notepad
find 'Antlr3.Runtime.pdb' and you found this in "ItemGroup". See ScreenShot
Remove below lines and save file.
Open project and re-rebuild solution.
It's working fine for me. Let me update here this is work for you???
For some reason "Clean" and "Rebuild" leaves the dll in the bin folder, but don't bring the missing .pdb.
The manual deletion of the entire bin's content and consequent "Rebuild" does the job

Settings.cs appears as a separate file after moving a project to a different folder

I tried to move a project from one folder to another following Hans Passant's advice:
Remove the project from your solution by right-clicking it in the
Solution Explorer window and choosing Remove. Move the entire project
folder, including subdirectories wherever you want it to go. Add the
project back to your solution.
After doing it, suddenly, a "Settings.cs" file appears in the solution, even though there is already a "Settings.settings" file under "Properties":
Also, when entering "Settings.settings" and pressing F7 ("View Code"), "Settings.cs" is opened.
How to fix it?
This is correct. Settings.cs is what allows you to save/change settings in your application through your application itself, instead of manually prior to building/running the project. It is auto-generated by your Settings.settings file. There is nothing to fix.
Well, what I have done is deleting both "Settings.settings" and "Settings.cs". Then I created a new "Settings.settings" file, and the problem is solved: There is a "Settings.settings" file, but the "Settings.cs" file is hidden.
Noted that if you have any settings in the file, you should keep a backup to restore the settings later in the process.

What is the easiest way to make a backup in visual studio 2013?

I want to make a backup from the whole project. I also need to rename every backup. I'dont like the way to copy the project folder and rename the folder and the project file.
I've already tried to make it like that:
http://jasonfaulkner.com/VisualStudioExpressProjectBuildBackups.aspx
But it doesn't work, I am always getting the error "Invalid parameters"
Does anyone already tried this?
Thanks
The DPack extension for Visual Studio includes the Solution Backup tool that creates a zip archive of the solution and auto names it.
Manually edit .sln file
This method is entirely aimed at renaming the directory for the project, as viewed in Windows Explorer.
This method does not suffer from the problems in the Remove/add project file method below (references disappearing), but it can result in problems if your project is under source control (see notes below). This is why step 2 (backup) is so important.
1- Close Visual Studio.
2- Create a backup of your .sln file (you can always roll back).
3- Imagine you want to rename directory "Project1" to "Project2".
If not using source control, rename the folder from "Project1" to "Project2" using Windows Explorer.
4- If using source control, rename the folder from "Project1" to "Project2" using the functions supplied by source control. This preserves the history of the file. For example, with TortoiseSVN, right click on the file, select TortoiseSVN .. Rename.
5- In the .sln file, edit all instances of "Project1" to be "Project2", using a text editor like NotePad.
6- Restart Visual Studio, and everything will work as before, but with the project in a different directory.
Alse would recommend TFS, a powerfull tool to do what you pretend. You will be able even to recover previous versions of specific files,if you have any error and you have troubles find it you can see what changes you did since last "check in " etc. There are many options

How to add existing project to Visual studio 2012 after renaming the project path

I had a C# class library project as part of my solution. I later updated the root folder of the project. Since the solution was pointing to the wrong path, I had to "delete" the project and then re-add it.
However, when I add the existing project, it says "The project file \myproject.csproj' has been moved, renamed or is not on your computer".
This is baffling because the .sln file has no reference to the project. (I checked the text contents)
How does VS cache the project with it's old folder path? The solution is version controlled in TFS, but the mappings point to the new folder structure, so it's even more confusing as to where it's trying to get the old folder path from.
Edit: I checked the .csproj file, the .csproj.vspscc and none of them have a path variable in them.
I have also tried deleting the .suo file.
This has been a trouble with Visual Studio for years now. In such a case, deleting the hidden .suo file in the root folder and restart VS will reconstruct a proper .suo file and almost always eliminate the issue.
If you use TFS, take a look at Just TFS' comment in the original post to avoid this problem in the future.

Files show as hidden in Visual Studio 2012

Hei,
So we have a whole group of people working on the same project and every now and then some files show as hidden, you know the blank file icon like obj or bin.
See my font and texture? They should be normal.
So, I can see them in the folder but not in solution explorer without hitting the Show Hidden Files. I can also modify them but I would like them back.
I have been trying to see if there was a solution but all I get is blogs on how to show hidden files.
So I found this thread
Visual Studio 2012 and missing files
that seems to be giving the reason of my problem. People are not saving properly before pushing to github.
Now is there a solution to this?(apart from saving properly) Can I make all of those files become normal files?
Cheers
Simply right click the files/folders and include them to source control again.
This usually happens if people check in new files/folders but do NOT check in the updated project file, too. The project file contains a list of all files which should be included within the solution. If this runs out of sync, exactly this crap will happen... ;)
Simply instruct your folks to properly check-in. Or do code review on check-in and verify that the project/solution file(s) are also checked in.
They show up as hidden because they're not part of the project/solution, but they are on your file system.
You can right-click the files and click Include in Project
If this does not solve the issue after checking in. The project file is what is not properly getting checked in.
Probably the problem is that they are not pushing the project file (file with extension .csproj). It holds all references to files included on the project so it needs to be pushed when new files are added.
Let everyone know that they need to push this file in order to everyone to catch latest changes on project.

Categories

Resources