In development. NET project, including WinForm Project and Web project, compile and deploy, need to consider the 32-bit X86 way, or 64-bit way, sometimes need to debug, if not properly set up these relationships, there may be no debugging problems, This article is based on my summary of the development of WinForm, introduced in. NET project to set up the project engineering.
1. Setting the properties of the build platform
In general, we need to be set up in order to be compatible with both 32-bit and 64-bit operating systems. NET project, which is generally set to X86. In the VS IDE, select the build-"Configuration Manager menu."
As the project settings for my hybrid framework are as follows, unified settings for X86 compatibility mode, make sure that all projects are X86 platform settings.
2. Settings for WCF services or Web projects
After the project has set the above compiler platform properties, in general, the WinForm program or class library run is fine, but if there is a WCF service or Web project inside the project, you need to note a setting, which is the bin directory settings. By default if you modify the X86 platform settings property, the output directory of the WCF service or Web project will change, typically bin\x86\debug\
This time the project is also able to compile smoothly, everything seems to be normal, but we modify some of the code, and debugging problems, there may be different source code and original version of the situation.
If this time, you according to these to Baidu or Google issues, may give you to find a lot of different solutions, but may not solve the problem, in fact, the problem is very simple to deal with the output directory is reset to bin, compiled debugging source code is also consistent.
3. The target framework of WinForm startup project
When creating a WinForm startup Project, the default vs created WinForm Startup Project, its target framework is always client profile (not known based on what considerations), and generally, we use external classes cubby less time, or called. NET own class cubby few cases, the problem does not appear, but we use this project to develop a period of time, gradually add some modules, we find that there are always errors, or there is a lack of some namespaces, this time, we should check whether it is your startup Project Target framework problem, It is possible that your target framework is the Client Profile mode, as shown below.
If we change it to the normal. NET framework Framework, then the compilation may be completely passed.
4,. NET Installation package settings
In order to facilitate the use of customer deployment, we often, we may put the program into a form of installation package, this mode also need to consider the 32-bit and 64-bit differences, generally we can choose X86 platform compatibility mode, in this case, we need to set the properties of the installation project X86 platform properties, as shown below.
In this way, the installation packages that we build can be successfully deployed on both 32-bit and 64-bit systems (they all run with 32-bit program mode). After the program is installed, we can see that its directory is also in the X86 program directory.
We make the installation package, in general, we may need to create a blank project, and then add the relevant release file to the project, there are actually some stress, in general, we first add the main program, the other parts will be automatically added according to the reference relationship. If you add a single brain to the DLL in the compiled directory, many of them may have duplicate references.
Therefore, to avoid the above problems, generally first add the main program EXE file, and then its related DLLs have been automatically introduced, and finally check the lack of those DLLs and some document files, and then add some in turn.
installation package In addition to the above situation needs to be noted, but also need to pay attention to your system prerequisite settings
If it is. NET4 program, we generally check Microsoft. NET Framework4 (X68 and X64) This prerequisite (note is not client Profile), so we can detect whether the user's system installed the necessary environment, if normal can run successfully.
The above is my development project, often used in some of the settings properties, although many seemingly very common, but every time must ensure that the successful set up, or there may be some errors inexplicable, will take a lot of detours.