Visual Studio Basic tutorials for assembly--llorch (final)

Source: Internet
Author: User

A generic example illustrates:
  • This series of blogs discusses only the basics of the tool and does not discuss any language.
    • Don't even discuss shortcut keys:-)
    • You can complete this tutorial with the mouse
  • The IDE default refers to Visual Studio Community Edition. At the end of this series of articles, you can skillfully use it to write programs.
  • The default layout state after Visual Studio startup is called the main window, and the project name displayed in the title bar of the main window is not necessary.
  • Several symbols describing menu actions are defined on the basis of daily spoken language and Windows Explorer: [], {},/, >>, =, (,).
  • check that a setting item is represented by:
    • [Window name]/{menu name}/{submenu name}/{Set item Item name}= Set value of item
  • For example, the default Debug configuration:
    • [Main Window]/{solution Configuration Manager}=debug
  • When checking multiple settings items, write each one in the same way as a single set item
  • When you check that a setting item has multiple values , parentheses are used to separate them with internal commas, such as:
    • [Solution Explorer]/{project name}/{reference}= (system,system.core,system.data,system.xml)
  • To perform a left-click sequence is to replace the last check with "/", such as exiting the IDE:
    • [main window]/{file}/{exit}/
  • The connection symbol for the right-click menu is >>, such as refreshing the Windows desktop:
    • [Desktop]>>{Refresh}/
  • The representation of a setting item in a pop-up window is similar to
  • The representation of the set item in the MDI child window is similar to the above, noting that in Visual Studio, the name of the MDI child window is in its upper-left corner or may be automatically adsorbed around the main window
  • title bar and status bar as the promotion of the menu, applicable to the above presentation method
  • Defect description
    • Welcome feedback, mailto:[email protected]
    • The preferred language for the author is C #
    • The author is a soft dog
    • The author's IDE does not have a Chinese language pack, so some nouns are not translated correctly:-(
    • Due to the lack of clarification of the relevant certificate issues, copyright reserved
    • Series of articles did not propose or solve new problems, the purpose is only science

Body

The new thing that Visual Studio brings is powerful control of the assembly.

Pre-Discussion preparation: VS2013 developer Command Tips >> External Tools
    1. [Start]/{All Programs}/{visual Studio 2013}/{visual Studio tools}/, open the VS Tools folder
    2. Right click on the shortcut "VS2013 Developer Command Prompt", select the property, copy the contents of the text box corresponding to "target".
    3. [Main window]/{tool}/{External tool}/, outgoing [external tool window]
    4. [External Tools]/{Add}/
    5. [External Tools]/{Menu content}= new tool 1/{title}=vs2013 command prompt
    6. [External tool window]/{Menu contents}=vs2013 Command prompt/{command}=%comspec%
    7. [External tool window]/{menu content}=vs2013 command prompt/{parameter}= paste the contents of the parameter section (delete the front%comspec%)
    8. [External tool window]/{Menu contents}=vs2013 Command prompt/{initial directory}=$ (ProjectDir)
    9. [External tool window]/{menu content}=vs2013 command prompt/{app}/
    10. At this point, you can invoke the main window]/{tool}/{vs2013 command prompt from the IDE}/, which is the project directory each time you open the initial directory. Other options include a binary directory (depending on the solution configuration corresponding to Bin/debug or bin/release), the target file directory, the solution directory, and so on.

The relationship of the project to the Assembly in Visual Studio

The specific form of the assembly in the Windows operating system is the. net file with the extension DLL and EXE. One. NET files are different from traditional executables (even traditional COM components). NET file has a new file structure and most importantly relies on the. 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 build details. As a Visual Studio user, you can simply assume that a project in Visual Studio corresponds to its build target, which is the output assembly.

An assembly that "outputs" a project can refer to many assemblies as an "input" to the project. The configuration of the assembly is usually for each purpose, and the content is stored in the "project name. csproj" file.

Private and shared assemblies

Assemblies are typically used by an application alone and are not shared by default. With a special location (GAC, global Assembly Cache), the assembly can be shared globally on the operating system so that applications on it can be used.

Private assemblies

Assemblies that directly compile the Viusal studio template "Output" are private.

Assemblies that are not normally registered to the GAC are considered private. The search path for the private assembly is inside the project folder. These assemblies are typically moved along with the deployment of the project (Click Once). This strategy is useful because some features need to rely on a specific version of the private assembly, and this version does not match the GAC.

It is necessary to clarify the search path for private assemblies, and when you introduce a non-GAC third-party library to your project, make sure that all assemblies and their dependencies have entered the project's search path.

Shared assemblies

As the name implies, shared assemblies are assemblies that can still support project runs without being copied to the project folder. Shared assemblies are primarily managed automatically by the CLR.

A shared assembly is typically installed in the Global Assembly Cache folder (GAC) and its assembly name is globally unique. You can register an assembly to the global assembly cache by using the Strong Name tool (Sn.exe) and the GAC Administration Tool (Gacutil.exe).

View the contents of an assembly

Generally, two graphical methods are used to view the contents of an assembly.

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 VS2013 Command prompt, enter (excluding <)

> ildasm

ILDASM is a graphical utility that allows you to view more assembly meta-data information.

Publish project output to GAC

Requires four steps: Naming, signing, rebuilding, and installing to the GAC.

1. Create a strong name

Open 2013 command prompt, input (not including <)

> Sn–k mykey.snk

2. Sign the Assembly

[Solution Explorer]/{Project n}>>{property}/{Signature}/{sign the assembly}= tick

[Solution Explorer]/{Project n}>>{property}/{Signature}/{Select Strong Name key file}=< browse ...;, exhale [Create Strong name key] window

Navigates to the mykey.snk generated in the previous step.

3, after the setup is in place, rebuild, you get the shared assembly

4. Install the shared assembly to the GAC (Command prompt that requires administrator privileges, may need to start from the Start menu, with Administrator privileges)

Open VS2013 Command prompt, enter (excluding <)

> gacutil/i Mywork.dll

Add an assembly to a project

1. Add a reference to the assembly statically. Use

[Solution Explorer]/{Project n}/{reference}>>

2. Programmatically add an assembly to the application in a programmatic manner. Please refer to the relevant MSDN content for details.

Uninstalling assemblies

Assemblies cannot be uninstalled directly from the application. To unload an assembly and keep the application running, you need to write code and use the concept of an application domain.

NuGet Package Manager

Using the NuGet Package Manager, Object Browser, and MSDN documentation, you can help users find assemblies that meet their requirements.

NuGet brings together the resources of the community so that developers don't have to reinvent the wheel.

Summarize:

Assembly concepts are often a basic knowledge of the more confusing-prone. This article attempts to go through it in a cursory manner from the point of view of actual operation.

This is the last article in the Llorch Visual Studio Basic Tutorial Blog. The main purpose of the series blog is to organize the problems that Visual Studio uses. Because Visual Studio itself has a very wide range of uses, especially its code intelligence tips and Object Browser, it is very powerful. Visual Studio's operations are not spoken in classrooms or even in forums. This is the motive for writing a blog.

Visual Studio is a rare and excellent programming IDE. Although it has evolved over time, the programming language it supports has become closed and backward. But for the vast majority of programming enthusiasts, students and some professional developers, it is still a tool for the GTD.

Llorch's series of blog information is relatively large. Basically a blog corresponds to a half-day of actual operation. The best way is to read while working. At the end of the entire series of blogs, Llorch to convey the idea that the IDE is a tool for guaranteeing code. The center of programming work is the code that is output as a product. The fundamental purpose of using the tool is to assist the worker in concentrating on it.

Thank you very much for the feedback given by enthusiastic netizens.

As the author's level and experience are limited, the mistake of omission is unavoidable. I implore you readers to correct me. Please email to cqwd2010&qq.com (& @).

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission (Mailto:[email protected]) shall not be reproduced.

Visual Studio Basic tutorials for assembly--llorch (final)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.