How to extract vb forms from exe file or project file - visual-studio

I have to formate my PC. I have installed Visual Studio again. Earlier I have a project
on Visual Basic. I have the Project files saved as .VBP extn and also have and ExE file for
the same project. It is also running. But How can I retrieve the Forms i have created in VB from these Exe and Project file.

Let's clear something out of the way first, there's no strightforward way to get those forms out of the .exe file, so that is not an option.
On the other hand, the .vbp file is the project file, it does not contain the forms themselves, but it can help you locate them forms.
Visual basic doesn't require for the form files (.frm) to be stored on the same folder as the project file, that is why the project file stores the location of those forms. All you have to do is right click on your VBP file and select open with from the context menu, then select notepad from the list and you will see the plain text contents of your VBP file. Around the top there should be a few lines that look like these (depending on how many forms your project has):
Form=Form1.frm
Form=....\Form2.frm
Form=..........\Source Code\Form3.frm
Those are the "relative" paths of each of the frm files on the project. If yours looks like the first one where there's no path, then it means the frm files where stored in the same folder of the vbp and you have lost them (someone might have deleted them, or not copied them when they sent you the project), in that case there's nothing you can do to retrieve them.
But if the lines on your vbp file look like the second and third line, then search into those folders and the form files "should" be there, but unfortunately there's no warranty.
Hope that helps!

Related

re-including the entire contents of a folder in visual studio 2013

I have an included folder in visual studio, which contains mainly javascript files, CSS, images, etc. These are not required for the website to run, and are altered not from Visual Studio but from other external processes.
I've been publishing to Windows Azure Websites, which require all files to be included so that they are uploaded as part of the package.
Is it possible to somehow click on a folder in the Solution Explorer, and 're-include' all it's contents?
The only option I found right now is to exclude and re-include, which due to the amount of files takes quite some time. It takes ages to 'exclude' the folder. Then, once it's ready I have to re-include which takes a long time as well. Would like to at least do them in one operation.
Was wondering if there was a better process somehow.
I'm not quite sure why you have exclude them all and include them again. Is it because the file names change or new files created often? If the file names stay the same and just the contents are changing you should not have to re-include them. If the external processes create new files now and then, then you should be able to click the "Show all files" option in solution explorer and then when you load the solution check the directory in solution explorer and any new files there include them.
hope that helps in some way. :)

Where are Visual Studio 2013 Solution Folders?

My Current Situation:
I had a solution in which I split a large MVC project into two smaller projects. Of course the two smaller projects reference the same JavaScript and content files that were in the old larger project.
What I wish to do:
Instead of duplicating the scripts and content in the 2 projects, I want to create a shared folder that the 2 project refer to using something like a link or a shortcut.
How I am trying to approach the problem:
I think that solution folders are the solution to my problem. So I want to create a solution folder to which I will move all my scripts and content files.
However, my problem is that I have to move file by file to this folder since we cannot simply add an existing folder (I moved the scripts and content folders to the solution directory itself instead of being inside a specific project). And this is so tedious.
Here is what I tried to do:
First I tried to locate where solution folders are created. However, I discovered that solution folders don't physically exist. I think they are just some kind of logical structuring to your solution. Whenever you add a file to a solution folder it is physically added to the solution directory.
I thought that the solution file (.sln) may contain the configuration of solution folders and their content in some kind of xml format. However, this doesn't seem to be the case.
I opened the SQL Server Compact Edition file (.sdf) of the solution thinking that may there is a DB table that describes the solution folders. However, this also doesn't seem to be the case.
So, finally, my question is:
Is there any easy way to add an existing folder as a solution folder in order to avoid adding files one by one (I have too many files).
Update:
Thanks for the answers and suggestions. I ended up taking a somewhat different approach. I used a pre-build command: XCOPY "$(SolutionDir)Files\*.*" "$(ProjectDir)" /E. I did this because the suggested solutions and my previous attempt was to add links/shortcuts to the external resource files. While this was fine and shortcuts were actually added to the project, when I tested the MVC project, IIS didn't manage to load the resource files since it looks for physical files (of course).
So my query now is: is there someway, whether a build event or and configuration in the csproj file, to "Include In Project" the newly "physically" copied files?
As drew advised: editing the project file is one way. Another way is to edit the Solution file in a mechanism similar to that of the csproj file.
In a solution file, a project with a specific GUID holds the details of a set of folders.
Write a small app that will read your folder and output a small text of the desired output. Generate new Guids until the file is created. Just paste this at the top of the .sln file. 2150E333-8FDC-42A3-9474-1A3956D46DE8 seems to be the GUID used for Solution Items.
This sample has a few subfolders with content in a nested structure.
i.e.
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NewFolder1", "NewFolder1", "{4CDFCC66-45BD-4B6D-8758-FEF7E9F61C1C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SubFolder1", "SubFolder1", "{771BDBFB-5C01-4C51-A170-D88ECA8DE896}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SubFolder2", "SubFolder2", "{5D23AB90-5EF6-4611-A575-34F7B50BB1B6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NewFolder2", "NewFolder2", "{135E9F67-2DF8-4458-AC6D-FF82FC1B3BC6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SubSubFolder1", "SubSubFolder1", "{B41C7BAA-7E3D-405B-96AB-005120D12D26}"
ProjectSection(SolutionItems) = preProject
NewFolder1\SubFolder1\SubSubFolder1\a.txt = NewFolder1\SubFolder1\SubSubFolder1\a.txt
EndProjectSection
EndProject
Solution folders (on the file system) are optional, and in Visual Studio they're typically used just to organise files within Visual Studio.
It's a manual approach to create a "physical" folder at the same level as the solution but this reduces complexity.
Below are the steps for moving a single script file:
On the File System
Create a solution folder (typically at top-level directory)
Copy script file from (one) project to solution folder
In Visual Studio
Create a solution folder
Right-click solution folder, select Add > Existing item...
Select script file from the new solution folder on file system, then click Add
Exclude/Remove script file from project1
Right-click project1, select Add > Existing item...
Select script file from solution folder on file system, select "Add as link" from the drop down on the Add button
Repeat steps 6-8 for all other projects
By using "Add as link" the main thing we've done is to add a reference to the script in the solution folder as opposed to the actual file being copied to the project folder.
Note that you're not limited to working with one file at a time, it's just easier to track.
The fastest way I know of to find where you solution folder is located:
Within Visual Studio, open the "Solution explorer if it's not already open View -> Other Windows -> Solution Explorer (CTRL + ALT + L)
Within the solution exploerer, Right-click your project or solution
Select Add -> New Item.
The window that pops up will allow you to select a new file template, but what you're looking for is the "Location" field at the bottom. It should have the path to your solution folder. It's a safe bet that your solution folder is at this location or up a couple levels.
Once you get the path to your solution folder you can click Cancel to exit the wizard.
As far as I can tell, visual studio doesn't provide this feature through their interface. The intention probably is that project files exist within the project folder rather than being separate. It generally makes working with projects easier (moving, sharing, etc).
That said, you don't have to have every real folder in a project location actually included in that project. So you could do something like the following folder structure:
+ /Projects (contains ProjectA.csproj and ProjectB.csproj)
|
+-- /ProjectA (folder with files that are just for "ProjectA"
|
+-- /ProjectB (folder with files just for "ProjectB")
|
+-- /Shared (Folder with your shared scripts/files)
With this structure you should be able to use the "Show All Files" button and include the shared folder in both projects. You will probably need to manually edit the csproj files to map to this new structure but it shouldn't be too difficult.
The only other option I can think of is to try to manually edit the csproj files such as this question shows.
Hope that all helps. Best of luck!
My final solution to the problem is a combination of the solutions suggested answers and the approach I decided to take so that local IIS can see the files.
I added the following section to the csproj file:
<Content Include="..\Files\**">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Content>
I also added the following command as a pre-build event in my project:XCOPY /y "$(SolutionDir)Files\*.*" "$(ProjectDir)" /E

Which file should I compile from source code folder in VB

I have a source code folder of a software and it is written in VB 6.0.
The source code folder contains different files. Which file should I open and compile?
May you please tell me step by step procedure of opening a file with help of VB 6.0.
When you open VB6 the New Project window opens by default. Click the Existing tab and browse to your source code folder. The Files of type file filter will already be set to the default VB6 project file types.
*.mak - Older VB projects. I'm not sure when this was changed, but VB3 still used this extension.
*.vbp - The default VB6 project file extension
*.vbg - The default extension for a group of projects
If you have a *.vbg file, you should have multiple *.vbp files and the *.vbg file is probably the file you want. Otherwise, unless you are opening a really old project you will probably open the *.vbp file. If you have multiple *.vbp files in your source code folder without a *.vbg file present open the *.vbp file with the name closest to the exe, or dll file you are trying to compile the code to, if you know it.
Open the project file (.VBP) in the VB6 IDE. File menu, Open Project
Suggestion: read some VB6 tutorials...

Change default Add File path in Visual C++ 2010

When adding a new item in a Visual C++ project, the default path for the new file is the project path. Are there any per-project or per-solution settings that allow this default path to be modified?
For example, to add new files by default to a subdirectory of the project folder, or even to somewhere outside the project folder?
I understand that filters can be used to automatically organize files visually within the Solution Explorer based on file extension, but I would like to actually place the physical file in another location without the need to browse to it.
I'm using a Visual C++ project as a container to to manage and organize (filter) editing of runtime-compiled files, and don't want developers to accidentally place new files outside of the intended folder, nor do I want the project file to exist in this code folder.
I did discover that if you create a new file in a sub directory of the project, that the Add Item dialog will default to that path when you add another file during that session, but it does not persist the default to the project or solution for future sessions.
I don't believe there's anything built-in. Some commercial add ins make the behavior better. For example, Whole Tomato's Visual Assist X package always uses the same directory as the currently open file, IIRC.
There are a couple of open source add ins that let you modify the behavior. For example, this one.

Visual Studio Copy Project

I would like to make a copy of my project. I would rather not start doing it from scratch by adding files and references, etc. Please note that I don't mean copy for deployment. Just plain copy.
Is there a tool in VS to do this? I am using VS 2008
Just create a template;
From your project choose: Project - Export Template
The wizard will let you define
Template name
Template Description
Icon
Preview image
Then it zips up your project into 'My Exported Templates' directory.
You also have the option to make your template available when you create a new project.
When you use your template to create a new project, the namespace will be correct for 'your_new_project_name' throughout every file, all references correct, everything perfecto :)
You can send the .zip file to anybody, and they must copy (not unzip) the .zip file into Templates\ProjectTemplates directory for them to use too.
I made an ASP.NET MVC template with folders, layout page, viewmodels etc arranged just how I like them.
NOTE:
If you have an empty folder in your project, it WON'T be added to the template, so I just added an empty class appropriate to each folder, and a sample picture for images folder.
If you want a copy, the fastest way of doing this would be to save the project. Then make a copy of the entire thing on the File System. Go back into Visual Studio and open the copy (by right clicking on solution => add existing project => open the copied project). From there, I would most likely recommend re-naming the project/solution (Steps of Safely Renaming Project are in the following link) so that you don't have two of the same name, but that is the fastest way to make a copy.
It is highly NOT ADVISABLE to copy projects at all because the some config files formed internally like .csproj, .vspscc etc. may (and most probably will) point to references which belong to previous solutions' location and other paths/locations in system or TFS. Unless you are an expert at reading these files and fixing references, do not try to copy projects.
You can create a skeletal project of the same type you intend to copy, this creates a proper .csproj, .vspscc files. Now you are free to copy the class files,scripts and other content from the previous project as they will not impact. This will ensure a smooth build and version control (should you choose to be interested in that)
Having said all this, let me give you the method to copy project anyhow in a step-wise manner:
Go to the project you want to copy in solution explorer and right-click.
Now select 'Open Folder in File Explorer' (Assuming you have the solution mapped to a local path on your disk).
Select the Projects you want to replicate as whole folders(along with all dependencies,bin .vspscc file, .csproj file)
Paste them in your desired location (it could be your same solution folder or even another solution folder. If it is within the same solution folder, then you would be required to rename it, also the .csproj and other internal files to the new name).
No go back to Visual Studio, Right-Click on Solution > Add > Existing Project...
Browse and select the Project file (.csproj file) now from the location you placed it in and select 'open'
This file now appears in the solution explorer for you to work.
You may now have to resolve a few build errors probably with duplicated/missing references and stuff but otherwise it's as pristine in logic and structure as you expected it to be.
I guess if this is something you do often, there's a little (non-free) utility that promises to do it for you: I haven't used it, so not sure how good it is:
http://www.kinook.com/CopyWiz/
There is also this project on CodePlex:
http://clone.codeplex.com/
I will probably give the codeplex project a try, and if it doesn't work I'll manually rename everything and edit the sln file.
I follow these steps and I use the development tool called Resharper ,which is awesome by the way:
So,
Copy the existing project folder to the destination you want
Go to source control and with right click just to the root folder you want and pick "Add items to folder...".Then, a wizard will come up to choose the files to copy (there is no need for some files and the wizard guides you for that reason by default).
Change the name of the solution file (*.sln)
Change the names of the sub-projects if exist.
Use Resharper to change the binding namespaces name (I will automatic do the dirty job with safety).The alternative way is to manually change all namespaces with the new name.
The same action with method names.
Check solution's properties if you want to change.
That's it. You are ready!!!
Following Shane's answer above (which works great BTW)…
You might encounter a slew of yellow triangles in the reference list.
Most of these can be eliminated by a Build->Clean Solution and Build->Rebuild Solution.
I did happen to have some Google API references that were a little more stubborn...as well as NewtonSoft JSon.
Trying to reinstall the NuGet package of the same version didn't work.
Visual Studio thinks you already have it installed.
To get around this:
1: Write down the original version.
2: Install the next higher/lower version...then uninstall it.
3: Install the original version from step #1.
The best way is actually to create a new Project from scratch, then go into the folder with the project files you want to copy over (project, form1, everything except folders).
Rename the files (Except for form1 files) for example: I copied Ch4Ex1 files into my Ch4Ex2 project but first renamed the files to Ch4Ex2.
Copy and paste those files into the Solution Explorer for the new project in Visual Studio.
Then just overwrite the files and you should be good to go!
Old thread but I hope it helps anyone looking for this answer!
The easiest way to do this would be to export the project as a template and save it to the default template location. Then, copy the template into the exact same directory on the location you want to move it to. After that, open up visual studio on the new location, create a new project, and you will get a prompt to search for a template. Search for whatever you named the template, select it and you're done!
I have a project where the source files are in in a folder below the project folder. When I copied the project folder without the source folder and opened the copied project, the source files are not missing but found at the old location. I closed the project, copied also the source folder, and re-opened the project. Now, the project magically references the copied source files (both the new path showed up on "save as" and a change in a file has been saved in the copied version).
There is a caveat: If not both old and new project folders are below a used library folder, the above-mentioned magic discards also the absolute reference to the library and expects it under the same relative path.
I tried this with VS Express 2012.
My solution is a little bit different - the computer that the package resided on died and so I was forced to recreate it on another computer.
What I did (in VS 2008) was to open the following files in my directory:
- <package name>.djproj
- <package name>.dtproj.user
- <package name>.dtxs
- <package name>.sln
- Package.dtsx
When I did this a popup window asked me if the sln file was going to be a new solution and when I clicked 'yes' everything worked perfectly.
After trying above solutions & creating copy for MVC projects
For MVC projects please update the port numbers in .csproj file, you can take help of iis applicationhost.config to check the port numbers. Same port numbers will cause assembly loading issue in IIS.
I use Visual Studio 2013 where Project > Export Template is not an option. Here is what I use to clone a project.
From your solution:
File > Export Template > select project to make template from, note save path
Download and install VS 2013 SDK Here
Create new VSIX project under Extensibility
From the VSIXManifest Dialog select the Assets tab
Fill in the Author textbox
Choose "Project Template" for Type and Browse to add the exported template (saved at path you noted in step 1)
Save and build the VSIX project. Go to the VSIX project's .../bin/Debug folder and double click to run the .vsix file
Start new instance of Visual Studio and you should see your template under whatever project type your template is. Create a new project from your template
You will have to re-add any dll references
Trick the Clone from repository tool
Open the project location in file explorer.
Copy the path to any browser (aka open the project location in the browser).
Use the address from the browser as the source repository for cloning.
Relax and enjoy the no error clone.

Resources