Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Without Visual Studio .NET Windows application development     - Bash difference in single quotes and double quotes (Programming)

- Enterprise Encrypting File System eCryptfs Comments (Linux)

- Linux more efficient than select a model epoll (Linux)

- Ten correct use Redis skills (Database)

- To build Spring RestTemplate use HttpClient4 (Programming)

- Hadoop namenode do NFS disaster recovery (Server)

- Java generate two-dimensional code by Zxing (Programming)

- Use Bash script write CVS version control (Server)

- Linux Command - ps: a snapshot of the current process (Linux)

- Iptables Instructions (Linux)

- Linux iptables: Composition Rules (Linux)

- How to configure a server in a MySQL Cluster (Database)

- Python when automated operation and maintenance often used method (Programming)

- Installation GitLab appears ruby_block supervise_redis_sleep action run (Linux)

- Ubuntu How to mount iso file (Linux)

- C language files update in real time (Programming)

- fcntl file locking function add (Programming)

- MacBook Air install Ubuntu dual system (Linux)

- echo command (Linux)

- SpringMVC the use of interceptors (Programming)

 
         
  Without Visual Studio .NET Windows application development
     
  Add Date : 2018-11-21      
         
         
         
  For .NET application developers, with Visual Studio (abbreviated VS) as the preferred development tool it should be a most natural choice. After all, this IDE provides a variety of excellent features: smart tips, debug, package management, etc., and now most of the features are free to use in the free Community version. It would appear, it seems to have no choice other tools necessary.

Having said that, but in some cases we can still choose from such as Visual Studio .NET IDE and development code. Recently, a man named Patrick Lambert developers are not introduced with Visual Studio .NET Windows application process in his blog post.

Patrick believes select from the VS development environment possible reasons: First, the developer might want in-depth look at the compilation process .NET application and do not want to be blinded by the graphical user interface. Second, the developer may, for some reason, a reason such as platform or operating environment can not be installed VS. Third, developers are only going to develop a very simple application, the size of the application for a 5KB to download a 5GB size IDE seems a bit too extravagant. If any of the above reasons that apply to your situation, you can consider to try Patrick tutorial.

Necessary rely

Before you start coding, first see what dependencies are required, assuming we choose C # language to develop .NET Framework-based applications. The good news is the .NET Framework no longer depend on other components, as long as the operating system installed on it before, you do not need to install any components it! And many systems automatically included when you install .NET Framework, you can check the C: \ Windows \ Microsoft.NET \ Framework verify that the installation directory. In this directory will list each installed version subdirectory.

Next, we want to get compile problems in the .NET Framework already comes with a C # compiler. This tutorial to use two binary files, which csc.exe is C # compiler, and msbuild.exe is responsible for reading the project file (.csproj file for example) and compile tools. That is, if someone sends you a Visual Studio project file, then you can without Visual Studio is installed by running msbuild to compile the source code.

Structure .NET project

Patrick describes the structure of the next VS project, although the need to create a project file in this tutorial, but the understanding of the structure of the project can help us understand some of the concepts. Generally speaking, in the new Windows project, VS will automatically create a Program.cs file as entry contains a code depends resource information .csproj file contains binary name, version number, etc. AssemblyInfo.cs file information, as well as It contains custom configuration information App.config file. Wherein App.config main purpose of this document is to configure some of the relevant dependent information, such as database connection strings, Social Login account and so on.

Subject Code

Next, Patrick shows a very simple code. Since this tutorial does not use Visual Studio and other IDE, so you can freely choose your favorite text editor to write the following code, and save it as helloworld.cs file:

using System;

namespace HelloWorld
{
    public class Program
    {
        static void Main (string [] args)
        {
            Console.WriteLine ( "Hello world!");
        }
    }
}
As you can see, the role of this code is to simply output in the console "Hello World!" Only. Because our focus point is not C # code itself, so you do not entangled in it too simple. Compiler directives are also very simple, just specify the location of the compiler file through / out: parameter specifies the output file and specify the final source code files, you can create applications that can be run up. Refer to the following command:

E: \ code> C: \ Windows \ Microsoft.NET \ Framework \ v3.5 \ csc.exe /out:helloworld.exe helloworld.cs
Microsoft (R) Visual C # 2008 Compiler version 3.5.30729.5420
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

E: \ code> helloworld
Hello world!

E: \ code>
Add the assembly information

Now you've got to run this exe file, but if the right to check the details of the file, you will find such as file description, version number and copyright information, etc. are blank. This information should be defined by the assembly, but usually we are to fill in the information in the VS. In fact, even without VS, too simple, just change it to helloworld.cs:

using System;
using System.Reflection;
[Assembly: AssemblyTitle ( "Hello World Application")]
[Assembly: AssemblyCopyright ( "(C) 2015 John Doe")]
[Assembly: AssemblyFileVersion ( "1.0")]

namespace HelloWorld
{
    // Class definition
}
Class definition is omitted here, because this part has not changed. One of the changes is the introduction of the System.Reflection namespace, and then provides the appropriate information for the assembly. Once again we compile, we can find them in the details of the file can be run.

Having a graphical interface applications

After introducing the console application created after, Patrick also introduced a graphical interface application from VS creation process. Microsoft now recommends creating uniform application by XAML language, which defines the application interface based on XML. However, for simplicity, Patrick here chose to create a desktop-based Windows Forms application.

Helloworld.cs modified code is as follows:

using System;
using System.Reflection;
using System.Windows.Forms;
[Assembly: AssemblyTitle ( "Hello World Application")]
[Assembly: AssemblyCopyright ( "(C) 2015 John Doe")]
[Assembly: AssemblyFileVersion ( "1.0")]

namespace HelloWorld
{
    public class Program
    {
        static void Main (string [] args)
        {
            MessageBox.Show ( "Hello world!", "Hi!");
        }
    }
}
Before the code is very similar to the changes, a change is the introduction of the System.Windows.Forms namespace, the other is through the MessageBox output. At run time, Windows will handle the creation of their own work and other graphics window.

References Third-party libraries

Finally, Patrick describes how to refer to third-party resources in the application, this code by using Amazon AWS SDK implements a function to send a short message notification:

using System;
using Amazon;
using Amazon.SimpleNotificationService;
using Amazon.SimpleNotificationService.Model;

namespace AwsSnsSample
{
    class Program
    {
        public static void Main (string [] args)
        {
            var sns = new AmazonSimpleNotificationServiceClient ();
            sns.Publish (new PublishRequest
            {
                Subject = "Hi!",
                Message = "Hello world!",
                TopicArn = "arn: aws: sns: us-west-2: 0000000000: snstest1"
            });
        }
    }
}
Before compiling, you must first download an AWS SDK, and set the corresponding IAM account for sending messages. In the compilation command, the point is that by / r: Specifies the AWS option Quote:

E: \ code> C: \ Windows \ Microsoft.NET \ Framework \ v3.5 \ csc.exe /out:helloworld.exe / r: "C: \ Program Files (x86) \ AWS SDK for .NET \ bin \ Net35 \ AWSSDK.dll "helloworld.cs
Although the application described in this article is relatively simple, but in fact the principle is the same, a similar method can also be created based on ASP.NET, Azure, or WPF applications. While Patrick is not recommended to take this relatively primitive way in the professional application development, but the understanding of this process could help .NET developers understand the process of compiling this knowledge will point during their professional application development provide great help.
     
         
         
         
  More:      
 
- Zabbix monitoring of the switch (Server)
- Android gets the global process information and the memory used by the process (Programming)
- How to install Ubuntu strategy game Wesnoth 1.12.0 (Linux)
- Packages with Snort intrusion monitoring light (Linux)
- How to configure security management services under Linux (Linux)
- Oracle database file path changes (Database)
- Ubuntu 14.10 / 14.04 / 12.04 installation GNOME Pie 0.5.6 (Linux)
- How to configure security services under Linux (Linux)
- Under CentOS 7 installation and deployment environment Ceph (Server)
- Oracle Bug caused by the collection of AWR Snapshot fault (Database)
- Calling Qt libraries to implement functional processes of some summary (Programming)
- Shell command line operation (Linux)
- Binder began to talk about inter-process communication mechanism from Android AIDL (Programming)
- Linux system package manager (rpm, yum, source packages installation) (Linux)
- C language preprocessor command (Programming)
- Java environment to build a number of issues (Linux)
- File compression and packaging commands under Linux (Linux)
- Windows7 / 8 / 8.1 hard drive to install Ubuntu 14.04 dual system (Linux)
- Java Learning: elegant string (Programming)
- Install Krita 2.8 on Ubuntu 13.10 / 12.04 / 12.10 (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.