Copying from existing project - visual-studio-2010

I have some problem in visual studio.Ok here is the scenario
first i add an existing project to my project in visual studio,and after that i tried to compile and run and it works properly...and then i exit the visual studio. and copy the folder or the visual studio solutions into my laptop.after that i open the visual solutions in my laptop after the visual studio loads,the project that i add before is greyed out and empty...can you help me on this please how can i see back my project that i add before.

When you add an existing project to a solution, you're adding a link. You didn't copy the actual project, you just copied the link, which shows as empty on your laptop.
Right-click on the project and look at the properties, you should see the location. This should show you the problem.
You won't be able to recover that project without going back to the source, you don't have the code on your laptop.
-t.

Do you copy the project off your portable drive to your hardrive? Sometimes copying it off external drives has solved that issue for me.

Related

Visual Studio not showing all Projects in solution

I'm not sure why, but Visual Studio is not showing all the projects in my solution. I need them to show so I can set as default project under solution explorer. I'm not seeing a fix for this issue in a general internet search. The closest I see is VS not showing files folders, but this is different than my issue. Hopefully there is an easy way to fix it, without adding things again piecemeal. My co-workers can see their complete set of projects in solution explorer so it must be a corruption in my workspace.
Open your ".sln" project file using Notepad.
In this file you can observe listed projects like below
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.myProject.Data", "test.myProject.Data\test.myProject.csproj", "{6D7F7B84-F3BD-4A19-A069-D144C345B887}"
EndProject
Please add if there any missing projects. If you have old back up or co-workers file, Just copy and paste missing projects to this file.
In my case it works !!
close vs , delete .vs folder then open vs again. it works for me.
I found that re-adding the existing project to the solution worked for me!
I had to copy out changed files in my workspace, fix my permissions/ownership on my directory (it was no owner instead of me), re-do the mapped drive the workspace was on, re-do the shortcut to the Visual Studio project (even though it was supposed to theoretically be the same place I mapped), re-pull the project down, and copy my changes in again. At this point Visual Studio had the missing solutions in it again so I could set startup project and run the debugger. I'm not sure how the ownership/permissions got messed up. I think at one point the other office had a server go down, and maybe my permissions/ownership got mixed up then. I'm not sure why VS wasn't showing the missing projects, but it's fixed after doing the above.
I had the same issue where my colleague saw 1 more project on his computer.
I deleted my .sln file and got the exact same version as he. Problem was still the same.
Solution was: I had an unloaded project. Apparently this is safed in a local user setting file (probably the .suo file). I looked for the unloaded project and loaded it again.
Close the VStudio entire project, go to the main project folder and click on the .sln file to load the entire project agian.
go to solution explorer see which are having (unload), right click and load project with dependencies
sometimes check if the project startup has changed, if changed just right click on the related project and set as project startup
This .sln file structure breakdown offers a great insight on how projects are able to be found and populated into the project hierarchy. My .sln file had lost all its project persistence blocks and thus I had 0 projects under my solution. I copied the blocks from a a previous git commit and this fixed it. I still don't know why the blocks disappeared or the whole .sln file changed
If the other solutions didn't work for you, then try this.
You can add the missing project to the solution file using the dotnet command. To do so, go to the root folder of your project and run the following command from the terminal:
dotnet sln add ProjectLibrary/ProjectLibrary.csproj
The ProjectLibrary/ProjectLibrary.csproj is the path to your missing project.
You can open the .sln file to confirm if the prject has been added. You should see something like:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectLibrary", "ProjectLibrary\ProjectLibrary.csproj", "{F042B1DB-F887-44CC-941A-76569A86AF75}"
EndProject
Hope this helps.
I had the same issue. After opening the Visual Studio in Administrator mode it started to work.
Search for VS->Right click-> "Run as administrator"

Copy/Move Visual Studio Projects/Solutions To Another Computer

So I have a handful of Visual Studio projects that I need to move to another computer. Is it as simple as a copy and paste or will that mess something up? Both machines will have the same version of Visual Studio installed, so that shouldn't be an issue.
Is there an export function that I've overlooked?
If the Visual Studio version is the same, you can just copy the project folder.
Till the time you are moving your solution file and associated files you should be good.
In case you are using any source control update your solution from there.
Hope you have the same VS version and any addon frameworks you have
You can directly copy the project to the projects folder. This worked perfectly for Visual C++ projects for me (and also some other projects). But when I copied my Cordova App from one PC to the other (Both had Visual Studio 2015), I wasn't able to open the project. Whenever I tried to open the project, trying both the ways - directly from the Project file and the open option in Visual Studio, it at first opened but when I tried to open a file, it just got hung and didn't respond.
This problem may occur because Cordova apps have some configuration files that might be different for different PCs. I am not sure that this is the reason for the problem.
A solution that I used was that I created a new Project and copied the files to the project folders (excluding the configuration files).
Can you save the file to cloud? if so then you could potentially upload the file to cloud and download the file to the new

copying the visual studio settings for one project to another

I have a visual studio 2010 project done in VB.net and i have around 45 variables in the application settings. The one you set in the properties.settings. Now i m having a similar project and i wanna copy the settings variables to this project. Not sure how to proceed with this.
what i did is tried to copy the auto generated code for the settings into that project and it didnt work out well. I am not even sure how to google this out and tried the following.
copying application settings from one project to another in visual studio
moving application settings between visual studio projects
Both of this didnt get what i wanted and am actually out of clue on what to search for this.
So is there a way to directly copy the settings from one project to another project.
All I did was grab the physical Settings.Designer.vb and Settings.settings files found in the "My Project" folder of your applicaton (assuming it's a windows App and not web) and copied/replaced the existing settings files in the new project.
Did a rebuild of new project and errors kicked back but that was just the desinger code referencing the old project name. Corrected by replacing the old project name with the new one and voila, worked.
HTH
Dave

Visual Studio and TortoiseHg: folder not visible in VS

I created a C# project and added it to source control (mercurial). I can edit files in VS, commit it and push it using TortoiseHg. It goes to the server. When some one pulls they get the files.
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
However, now someone pulled the latest code from the server - and they got the new file (it is visible through windows explorer), but when they open the solution in VS, they don't see the file.
Does someone have an idea what is wrong here? or things I should check? Thank you for the help.
P.S. I have visual studio 2010 express (so I can't use the VisualHg plugin).
Visual Studio caches changes to the solution and project until an explicit save or a build. In your comment:
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
I see that an updated .sln or .vcproj file was not mentioned and checked in. Did you see an update to either of these files via TortoiseHg? If not, make sure to build or save your project after a change like this.
Did you make sure that the Visual Studio Project File or Solution file is being updated and committed?
VS solution contains projects and each project select managed files by metadata(***.vcproj file). It's not the way include all files from root directory.
So, your co-workers can see new added files by in following two ways.
1) share project file(***.vcproj)
2) manually add files in each person's VS instance.

Visual Studio Cannot Open File

I'm working on my first project in Visual Studio and I haven't used Windows much since '05, so please bear with me.
I've got my project open in Visual Studio 2008, and I'm trying to open a particular file for editing, but I get an error that says
"c:\path\to\file
Cannot open file.
I've verified that the file exists, and I can open it from Windows Explorer, but nothing from inside Visual Studio, any ideas?
I'm not familiar with Visual Studio, so my terminology might be incorrect.
The file appears in the tree in the Visual Studio Explorer pane, so I double clicked it, and got the error. The error said nothing more than the file path: Cannot open file.
How can I check permissions/ACLs in Windows? I assumed that since I could open it in Windows Explorer, I would be able to open it in Visual Studio.
And it's a .cpp file.
You may want to right-click on the file in the tree, and delete it from the project.
Then, add back an existing item.
Hopefully that will fix the problem.
Though I'm not familiar with this specifically, if you just want to move forward, I'd recommend creating a new project type and just adding all the existing files to it. Should be quicker and easier than diagnosing what could be many issues.
Other things to check: encoding type of the project file, permissions/ACLs (can you open that actual file from an unelevated VS prompt, for instance), etc.
Additionnaly to the other answers, I found out that this problem may arrise if the target .Net framework version specified in the project file isn't installed.
This seems to prevent visual studio from opening all the files contained in the project, and showing the "Unable to open file " message.
Correcting the version (in the csproj file or in the settings), saving and reloading the project fixes the problem.
I had same problem, my project were build on (.Net 4.5), which I uninstalled on my PC and replaced by (.Net 4.8), so just replacing project's target framework to the one which is installed "in my case (.Net 4.8)" should fix it.

Resources