Opening solution using Visual Studio 2017 - visual-studio

I have been working on this little mobile app for android using Xamarin in Visual Studio 2017.
When opening the solution with the laptop that I used to develop the app works like a charm. Then I zip the entire folder over the solution.
../myFolder/
app1/ //here is all the code
app1.sln //solution file
myFolder.zip
Transfer the zip file to other laptop/PC through usb, email and online repository, even extensions like rar, 7zp and tar. I simply can not load the solution from other Visual Studio but the one where I created/developed the application originally.
Hours passing with this screen then VS is not responding and after that, it simply crashes/closes with no error message.
In the other hand, I can open any solution created from any other PC in my laptop without issues. After saving, I haven't found the pattern yet, but some solutions can't be opened from the original PC which creates them nor others.

You may be using an older version of Visual Studio on the PC you've facing the issue. I've faced that too.
It was a known bug (reported here and here) already fixed on newer versions.
The workaround is to close VS, delete the folder vs created in the same directory of your solution and try to reopen it.
To avoid other problems on compiling or running your app after that, I recommend you also to delete all bin and obj folders from your project's folders, clean and rebuild the solution.
It's safer keep all your development environments updated in software wise to avoid this kind of trouble.
I hope it helps.

Related

How can I open a Visual Studio solution without loading all of its projects?

I have big solution in Visual Studio that has some Android, Windows Phone and iOS Xamarin projects. Unfortunately, Visual Studio hangs (for hours) when it tries to load the whole solution. It worked fine as long as I usually only loaded either the Android or the iOS project (and plug-in project), but not both at the same time.
Unfortunately, I changed it and now I can't load the solution anymore. I read that settings like these are stored in the .suo file, but I have no idea how I change it (and disable loading the Android projects for example). How can I close certain projects without doing this after the whole solution loaded?
Thank you!
You can open the sln file in notepad and just delete the projects you dont need.
But to make sure you don't mess things up I would suggest making a backup of your sln file.
You could just open the PRJ file that you're interested in all by itself.

Recover deleted project in visual studio

I was creating a website using visual studio and accidentally deleted that project folder. :(
It was three months project. Is there anyway to get it back? visual studio 2013
Are you using any Source control management system (e.g. SVN, git etc...)?
If so, this is the time for a revert. If not, you should...
Was the project deleted from your disk? If not (it shouldn't..),
just re add it to your solution. Chances are it is still in your solution folder
(You can easily open it via Visual studio).
If it was deleted from your HDD, this is where things starts to get tricky. Try restoring deleted data from your disk.
You will need a software to help you with this task (e.g. this one was randomly selected using a simple google search).
In case nothing of the above works you can take your HDD to a professional lab to restore the deleted data.
If it is just a small project, I wouldn't bother. If it is not, Shame on you for not using SCM ;0)
Good luck...
If nothing of the above works, I am sorry for your loss...

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

Recover a .CS class file after crash

I was working on a class in visual studio 2010 when suddenly my computer crashes. after I restart the computer. I start Visual studio and I find that class to be completely empty.
it contained more than 1000 lines of codes before the class.
is there anyway i can recover that file?
Help please because I don't have another copy of it (Stupid of me)
If you cannot find the source code file, try using Reflector to decompile the most recently built dll you have containing that class. It won't give you your complete source, but at least will give you something to start with.
Note: Reflector is no longer free; if that matters, try dotPeek from JetBrains instead.
Also, look into using a source code control system. This will let you 'commit' versions of your code to a repository, so you'll have a copy in case something like this happens in the future.
Subversion, Git, and Mercurial are popular ones; In my opinion, Subversion would be the easiest to start out with, especially with TortoiseSVN (OS integration) and AnkhSVN (Visual Studio integration). If you don't want to worry about setting up a repository/server, look into a hosted solution, like Beanstalk, which offers Subversion and Git and lets you try it out with a free, limited account.
Good luck - I hope you are able to recover your source!
Something which worked for me was back-up.
BTW I was trying to recover a VS2013 file on a Windows 8 machine.
Try to check in below location in your system.
C:\Users\username\My Documents\Visual Studio \Backup Files\ProjectFolder
I found an original file with original-date.filename.cs name and a recovered-date.filename.cs files.
The original was the one needed.
Deleted the one in project, added the original file and renamed it to file.cs. Tried building and debugging and it gave the expected results.
Also just want to add one more thing...
In my case i had an aspx page with its respective .cs and designer.cs
The .cs file got corrupted and I did build on project, with the designer.cs the project got build successfully and the dll got replaced. And when i tried to recover using reflector everything was in a state no return. :(
So don't build the project if you see any file got corrupted.
in visual studio 2019 I find the file in a files with TMP extension
FileName.cs~xxxxxxxx.TMP
This happened to me a few times as well when Visual Studio was crashed or System was shutdown unexpectedly.You can recover these corrupted file using Recuva. It dose not recover the file every time but in most of the cases it's work perfectly.
Below are the settings which you need to configure before recovery.
Start Recuva. Enter Advanced mode if the Wizard launches.
Click Options.
In the Options dialog box, click the Actions tab.
Click Scan for non-deleted files, and then click OK.
Run the Recuva scan as normal. Non-deleted files are indicated with a green double-circle status icon.
Hopefully, you will find your corrupted file in recovered files as it recover multiple versions for that file.
Very useful question. I got issue of file crash on sudden shutdown of my PC. recovered file using "Recuva"(download link: https://filehippo.com/download_recuva/) software. Scan for non-deleted files was helpful.
I got help from: https://www.samnoble.co.uk/2014/11/30/visual-studio-crashes-and-a-corrupted-cs-file/
Well, that happen recently for me and I did get my file back this way.
1. Find the project DLLs in the bin folder. Example MySolution.dll
2. Download and Install .Net Reflector from https://www.red-gate.com/products/dotnet-development/reflector/trial/thank-you
3. Open the .Net Reflector app and click the open folder icon then move to your bin directory and select MySolution.dll file
4. Then traverse and expand through your namespaces and classes to look into your codes.
5. Have fun!

Visual Studio 2005 and Sitecore ...Very very slow

We have Visual Studio 2005 and using Sitecore. In Sitecore solution we have different 4 projects. The problem is whenever I debug it takes much time to debug and then after debug when I run in browser it takes even more longer time.
I tried to clean the solution but did not work and I am trying to fix from many hours now and cannot find any solution.
I tired to create new project separately then it works fine its only with this solution of Sitecore which has problem.
Can anyone please help me...
Thanks!
this is a common problem in all versions of Visual Studio which is due to the many files in the /sitecore folder WHEN you have the "Show all files" turned on, on the project which contains Sitecore. I think Visual Studio tries to load each and every file when debugging with that option turned on.
Turn it off and you should be good to go :)
We include the Sitecore directory as a virtual directory in IIS, this way we don't have to have the Sitecore folder under the VS project root. Our typical setup for Sitecore is something like this:
/Site
/Website
/Layouts
/XSL
/Bin
/...
/Virtual
/Sitecore
/Sitecore Modules
/Data
The Visual Studio project then looks at the /Site/Website folder and knows nothing about the virtual folder.

Resources