I have a project with hundreds of dll references.
Now I have a dll named "Microsoft.Test.dll".
I want to get all the files in the project that reference the namespace "Microsoft.Test".
using Microsoft.Test;
Does visual studio have a function to query these files?
P.S. "Ctrl+F" is not what I want.
I recently obtained some files with the extension of .res
The problem I am facing right now is that I am unable to open it using different kinds of Resource Editors.
Here are the list of programs I have tried:
Visual Studio 2017
ResourceHacker
Delphi Decompiler
XN Resource Editor
And here is an example of the content of the file when opened in Notepad++: http://i.imgur.com/fcmEfED.jpg
What could be the cause of me being unable to open this file? Am I missing anything?
.res files are to .rc files like .obj. or .lib files to .cpp files - they are the compiled version of the resource definition files.
Don't expect that file to be editable by the likes of Notepad, treat it as any other compiled binary file. Especially since it really is a compiled binary file.
Having said that - when you "import" that file for use in your app you need to explicitly specify it in the list of "import libraries" (unlike a .lib file which the linker could infer from the list of dependencies). At least that is the case with MSVC++ 2015 (haven't tried it on 2017 yet)
Is it .vb like the latest version, I'm talking about version 6.0 (classic)? I'm trying to properly title a visual basic script for a module I need. If I have to redo a script because I cannot name a extension I am going to be mad.
There are several:
.cls (class file)
.frm (form)
.frx (form - binary information)
.ctl (custom control)
.ctx (custom control binary information)
.vbp (project)
.vbg (project group)
.bas (module)
Probably more...
The one you want is most likely .cls.
This answer as also good definitions:
https://stackoverflow.com/a/4385921/755977
From the documentation:
Project File Extensions
Visual Basic produces a number of files when you create and compile a project. These can be categorized as
follows: design-time, miscellaneous development, and run-time.
Design time files are the building blocks of your project: basic
modules (.bas) and form modules (.frm), for example.
Miscellaneous files are produced by various processes and functions of
the Visual Basic development environment: Package and Deployment
Wizard dependency files (.dep), for example.
Design-time and Miscellaneous Files
The following table lists all the design-time and miscellaneous other files that may be produced
when you develop an application:
TABLE 1 (Extension, Description)
.bas Basic module
.cls Class module
.ctl User Control file
.ctx User Control binary file
.dca Active Designer cache
.ddf Package and Deployment Wizard CAB information file
.dep Package and Deployment Wizard dependency file
.dob ActiveX document form file
.dox ActiveX document binary form file
.dsr Active Designer file
.dsx Active Designer binary file
.dws Deployment wizard script file
.frm Form file
.frx Binary form file
.log Log file for load errors
.oca Control TypeLib cache file
.pag Property page file
.pgx Binary property page file
.res Resource file
.tlb Remote Automation TypeLib file
.vbg Visual Basic group project file
.vbl Control licensing file
.vbp Visual Basic project file
.vbr Remote Automation registration file
.vbw Visual Basic project workspace file
.vbz Wizard launch file
.wct WebClass HTML template
Run-Time Files
When you compile your application, all the necessary design-time files are included in the run-time executable files.
Run-time files are listed in the following table:
TABLE 2 (Extension, Description)
.dll In-process ActiveX component
.exe Executable file or ActiveX component
.ocx ActiveX control
.vbd ActiveX document state file
.wct WebClass HTML template
In addition I have seen .vbi used as an "include" file. Basically a .bas module. I'm not sure how common this practice is.
I'm new in the world of Visual Studio. Can somebody please explain what these two files contain? I know that one of them contains info about project, but what about the other one?
A project file .vcproj / .vcxproj contains settings on how to compile your code into a DLL or a binary file, or something else that the linker can assemble into one unit. A project file is just an xml file that contains compiler settings, linker settings, and describes which files you want to compile.
A solution file *.slnis a text file that groups together multiple project files.
So if you think of it like a tree, then you have got a good mental picture of it like this:
.sln
.vcproj
.h
.h
.cpp
.cpp
.vcxproj
.h
.h
.cpp
.cpp
.csproj
.cs
Solution files and project files are in an XML format and describe the parts of your projects and their relations, configurations and so on. In fact, both of these files are simply MSBuild scripts (which are run through MSBuild when, you guessed it, building your project.)
This means they are easy to manipulate by hand if needs be (though this should be a rare case) and also allows to add custom parts to the build script, create custom build scripts for MSBuild that can include the solution file, among other things, or just simple auto-build scripts that pass the solution file (or project) to MSBuild, say, on version control check-in.
The difference between solution files and project files is that a project file holds information specific to that project, unaware of its solution (though, Visual Studio will look up the hierarchy to an extent in an attempt find the relevant solution when opening a project, if one exists); the solution file is aware of all projects that are part of that solution and references each of them (such as a directory of files, if you like, but with projects), it also contains solution-wide information / configuration, that can be applicable to all projects within the solution.
As pointed out by Hans Passant, there is an exception: files for C++ projects pre-VS2010 are not XML MSBuild files, but are instead a format documented by Microsoft on MSDN.
A .vcproj file contains information about HOW to compile source to a target (mostly, an executable). In many cases, it is crucial to have the project file for successful compilation, so do not delete it. It is compareable to a .dsp file (Visual Studio 6), a .prj file (Borland compilers), or a Makefile (Unix, GNU compilers) and contains paths and compiler/linker command-line options.
A .sln file is merely a collection of multiple .vcproj files. As Visual Studio can automatically create one if not present, there is no need to keep it for distribution or archiving. It's the successor of a .dsw file (Visual Studio 6). Its name "Solution file" is IMHO misleading.
In short: one is for solution, and the other is for project, and a solution can contain multiple projects.
Visual Studio allows multiple projects in a solution. The data what projects are in a solution is in the sln (solution) file.
I am automating my project using T4 templates. For this, I have to write some repeated code using T4 template and some hand written code which should not be overwritten by the T4 template. I would like to add the generated code file as the dependent file of the handwritten file. I am following convention of class1.cs for handwritten file and class1.generated.cs for generated file. How can I add this generated file in the project as dependent file of class1.cs?
To do this programmatically you'll have to modify the .csproj file directly. Refer to this question for details:
In Visual Studio (2008) is there a way to have a custom dependent file on another custom file?
If you want to do this via the IDE then use the VSCommonds Add-in for Visual Studio 2010.