Assembly-llorch Visual Studio basic tutorial (final), -- llorchstudio
General examples:
- This series of blogs only discuss the basis of tools and do not discuss any language.
- Do not even discuss the shortcut key :-)
- You can use the mouse to complete this tutorial.
- By default, IDE refers to Visual Studio 2013 Community Edition. At the end of this series of articles, You Can skillfully use it to write programs.
- The default layout status after Visual Studio is started is called the main window. The project name displayed in the title bar of the main window is unnecessary.
- On the basis of daily oral English and Windows Resource Manager, several symbols describing menu operations are defined: [], {},/,>, = ,(,).
- CheckThe expression of a configuration item is as follows:
- [Window name]/{menu name}/{sub-menu name}/{set item name} = set item Value
- For example, the default Debug Configuration:
- [Main Window]/{solution Configuration Manager} = Debug
- Check multipleWhen setting an item, follow the method of setting a single item,One by oneWrite
- CheckOne setting item has multiple values.And separate them with commas (,). For example:
- [Solution Explorer]/{project name}/{reference} = (System, System. Core, System. Data, System. Xml)
- RunA left-click sequence is to replace the last check item with "/", for example, exit IDE:
- [Main Window]/{file}/{exit }/
- Right-clickThe Connection Symbol of the menu is>. For example, refresh the Windows desktop:
- The settings in the pop-up window are similar.
- The description of the item set in the MDI subwindow is similar to that in Visual Studio, the name of the MDI subwindow is in the upper left corner of the window or may automatically expand to the four sides of the main window.
- The title bar and status bar are used as menu promotions.
- Defect description
- Welcome feedback, mailto: cqwd2010@qq.com
- The author's preferred language is C #
- The author is a soft dog.
- The author's IDE does not have a Chinese Language Pack, so some terms are not translated accurately :-(
- Copyright reserved because relevant certificate issues have not been clarified
- The series of articles did not propose or solve new problems, but only aimed at science popularization.
Body
Visual Studio brings about powerful control over the Assembly.
Preparations before the discussion: VS2013 developer command prompt> external tools
Relationship between project and assembly in Visual Studio
The specific form of an assembly in the Windows operating system is the. NET file with the extension DLL and EXE. A. NET file is different from a traditional executable file (or even a traditional COM component .. NET files have a new file structure. The most important thing is that they depend on. Net Framework X.Y (2.0? 3.5? 4.0 ?) Component execution.
A project in Visual Studio corresponds to a new assembly. The Visual Studio development environment integrates highly automated build tools, while shielding a large number of building details. As a Visual Studio user, you can simply think that a project in Visual Studio corresponds to its build goal, that is, the output assembly.
The "output" assembly of a project can reference many assembly as the "input" of the project ". The assembly configuration is usually for each project. The specific content is stored in the "Project name. csproj" file.
Private and shared assembly
An assembly is usually used independently by an application and is not shared by default. Through a special location (GAC, Global Assembly Cache), you can share an Assembly globally in the operating system so that all applications on it can be used.
Private assembly
The Assembly for directly compiling the "output" of the Viusal Studio template is private.
Generally, an assembly that is not registered with GAC is considered private. The search path of the private assembly is inside the project folder. These assemblies are usually moved along with the deployment of the project (Click Once ). This policy is useful because some features depend on private assembly of a specific version, which does not match that of GAC.
It is necessary to clarify the search path of the private assembly. When introducing a third-party library other than GAC to the project, make sure that all the Assembly and its dependencies have entered the search path of the project.
Shared assembly
As the name suggests, shared Assembly refers to the Assembly that can still support running projects without being copied to the project folder. Shared assembly is managed automatically by CLR.
Shared assembly is generally installed in the Global Assembly Cache folder (GAC), and its set name is globally unique. You can use the Strong names tool (sn.exe.exe and gac .exe) to register an assembly to the global assembly cache.
View Assembly content
Generally, two graphical methods are used to view the Assembly content.
Object Browser
[Main Window]/{view}/{Object Browser }/
This is actually a highly efficient programming manual, especially when a third-party library is introduced.
Ildasm
Open the VS2013 command prompt and enter (not included <)
> Ildasm
Ildasm is a graphical utility that allows you to view more Assembly metadata information.
Release project output to GAC
Four steps are required: name, signature, regenerate, and install to gac.
1. Create a strong name
Open the 2013 command prompt and enter (not included <)
> Sn-k mykey. snk
2. Sign the Assembly
[Solution Resource Manager]/{Project N }>>{ properties}/{signature for assembly} = check
[Solution Resource Manager]/{Project N }>>{ properties}/{signature}/{select strong name key file }=< browse…>, Call out the [Create strong name key] window
Navigate to mykey. snk generated in the previous step.
3. After the configuration is in place, the shared assembly will be generated again.
4. Install the shared assembly to GAC (the command prompt requires administrator permission, which may need to be started from the Start Menu with Administrator permission)
Open the VS2013 command prompt and enter (not included <)
> Gacutil/I mywork. dll
Add an assembly to the Project
1. Add a reference to the Assembly statically. Use
[Solution Resource Manager]/{project N}/{reference}>,
2. Add the Assembly dynamically to the application through programming. For details, refer to the relevant MSDN content.
Uninstall assembly
You Cannot uninstall an Assembly directly from an application. To uninstall the Assembly and keep the application running, you must compile the code and use the concept of application domain.
NuGet Package Manager
The NuGet Package Manager, object browser, and MSDN documentation help you find the required assembly.
NuGet is mainly a collection of Community resources, so that developers do not have to duplicate the wheel.
Summary:
The concept of assembly is usually a basic knowledge that is easy to cause confusion. This article attempts to roughly repeat it from the perspective of actual operations.
This is the last article in llorch's Visual Studio basic tutorial blog. The main purpose of the series of blogs is to sort out the problems used by Visual Studio. Because Visual Studio is widely used, especially its code smart prompts and object browsers, It is very powerful. Visual Studio is not used in classrooms or even forums. This is the motivation for blog writing.
Visual Studio is a rare and outstanding programming IDE. Although the programming language ecosystem it supports has become closed and backward over time. However, for programmers, students, and professional developers, it is still a tool based on GTD.
Llorch's series of blogs have a large amount of information. Basically, the previous blog corresponds to a half-day actual operation. The best way is to read while performing operations. At the end of the series of blogs, llorch wants to convey the idea that IDE is a tool to ensure code. The focus of programming is the code output as a product. The fundamental purpose of using tools is to help workers concentrate here.
I am very grateful to enthusiastic netizens for their feedback.
Due to the author's limited level and experience, mistakes and omissions are inevitable. Please let me know. Please email cqwd2010 & qq.com @).
Copyright statement: This article is the original author of the blog, not allowed by the blog (mailto: cqwd2010@qq.com) can not be reproduced.