


At the end of last year, thanks to the company's introduction of Jenkins, we took the first step in continuous integration. This article will not go into details on how to install Jenkins. The main focus is on configuring the .Net environment. In addition, this article is based on Jenkins installed in a Windows environment.
1. Installation environment
First we need to prepare several installation packages and install them on Windows:
.NET Framework 4.6.1 | https://www.microsoft.com/zh-cn/download/details.aspx?id=49982 |
Microsoft Build Tools 2015 | https://www.microsoft.com/zh-CN/download/details.aspx?id=48159 |
.NET Framework 4.6.1 Developer Pack | https://www.microsoft.com/zh-CN/download/details.aspx?id=49978 |
NuGet x86 Commandline | https://dist.nuget.org/index.html |
The first one is of course the familiar .NET Framework running environment;
The second one is MSBuild. Although we usually use Visual Studio to compile and publish programs using the graphical interface, Visual Studio actually calls MSBuild to perform various operations. Therefore, if we want Jenkins to automatically compile code, we must also prepare a set for it. MSBuild.
The third package is the .NET Framework 4.6.1 Developer Pack, which was called Targeting Pack in the past and contains a bunch of assemblies. For example, early versions of Visual Studio 2013 did not have .NET Framework 4.6.1 when it was released. If you want it to support it, you need to install this developer package. If you do not install it, you will be prompted with an error that the System.Object and System.Attribute assemblies cannot be found when compiling the 4.6.1 program later. The 4.6.1 Developer Pack contains the contents of the 4.0, 4.5, and 4.6 Targeting Pack. Installing the 4.6.1 package does not require the installation of other versions of 4.0 packages. In addition, if you need Chinese support, you need to install the English version first, and then install the Chinese language pack.
The last item is the NuGet console program. Before compiling the program, you need to use NuGet to restore the package. This software does not need to be installed, just put it in a fixed location, such as D:\Tools\CI.
2. Install the Jenkins plug-in
Enter the Jenkins plug-in management page and install the MSBuild plug-in at: https://wiki.jenkins-ci. org/display/JENKINS/MSBuild+Plugin
After installation, enter the "Global Tool Configuration" interface:
Find the "MSBuild" column in the opened page, first click "MSBuild Installation", and then click the "Add MSBuild" button to configure the path of MSBuild.exe. Since I use 32-bit MSBuild, I can configure it like this:
Default installation path of MSBuild
32-bit | C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe |
64-bit | C:\Program Files ( x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe |
Don’t forget to save after configuring.
3. Jenkins Job Configuration
After preparing the running environment and Jenkins plug-in, let’s create a new Job and give it a try. Our company uses Subversion, so I will download the code from SVN. Using repositories such as Git is also similar, so I will skip it here.
1. Restore NuGet package
We need to add an "Execute Windows batch command" step in the "Build" column to restore the NuGet package Restore
1 D:\tools\CI\nuget.exe restore .\YourSolutionName.sln
First, specify the path of nuget.exe, and then use the restore command to restore the package of the YourSolutionName.sln solution file in the current directory. You can modify it according to your actual situation.
2. Configure MSBuild compilation parameters
Still in the "Build" column, create a new "Build a Visual Studio project or solution using MSBuild" (generated using MSBuild VS project or solution) Steps
From top to bottom, in order
The selected MSBuild version
The path + file name of the target project or solution file
MSBuild parameters
Here we mainly talk about "Command Line Arguments" configuration, for more comprehensive MSBuild documentation, please refer to MSDN: https://msdn.microsoft.com/zh-CN/library/dd393574.aspx
I hope to generate a ASP.NET MVC project and publish it to the file system, mainly using:
/t:Rebuild Rebuild
-
/p:Configuration=Release Release generation mode
##/p:VisualStudioVersion=14.0 Specify sub-toolset (https:/ /msdn.microsoft.com/zh-cn/library/bb383796.aspx) version, if not set, an error will be reported
/p:DeployOnBuild=True;PublishProfile=Testing-Environment -CI-publish Use the Testing-Environment-CI-publish.pubxml publishing file to publish the project
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14" was not found .0\WebApplications\Microsoft.WebApplication.targets”At this time, you only need to find a computer with Visual Studio 2015 installed and change C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio Copy all the contents in the \v14.0 directory to the directory of the Windows system where Jenkins is located, and then rebuild it.
There may be some content about Jenkins integrating xUnit.net unit testing and automatic release later, but I don’t know if it will be available before the year Can’t post it XD I hope the article can be useful to everyone.

C# is not always tied to .NET. 1) C# can run in the Mono runtime environment and is suitable for Linux and macOS. 2) In the Unity game engine, C# is used for scripting and does not rely on the .NET framework. 3) C# can also be used for embedded system development, such as .NETMicroFramework.

C# plays a core role in the .NET ecosystem and is the preferred language for developers. 1) C# provides efficient and easy-to-use programming methods, combining the advantages of C, C and Java. 2) Execute through .NET runtime (CLR) to ensure efficient cross-platform operation. 3) C# supports basic to advanced usage, such as LINQ and asynchronous programming. 4) Optimization and best practices include using StringBuilder and asynchronous programming to improve performance and maintainability.

C# is a programming language released by Microsoft in 2000, aiming to combine the power of C and the simplicity of Java. 1.C# is a type-safe, object-oriented programming language that supports encapsulation, inheritance and polymorphism. 2. The compilation process of C# converts the code into an intermediate language (IL), and then compiles it into machine code execution in the .NET runtime environment (CLR). 3. The basic usage of C# includes variable declarations, control flows and function definitions, while advanced usages cover asynchronous programming, LINQ and delegates, etc. 4. Common errors include type mismatch and null reference exceptions, which can be debugged through debugger, exception handling and logging. 5. Performance optimization suggestions include the use of LINQ, asynchronous programming, and improving code readability.

C# is a programming language, while .NET is a software framework. 1.C# is developed by Microsoft and is suitable for multi-platform development. 2..NET provides class libraries and runtime environments, and supports multilingual. The two work together to build modern applications.

C#.NET is a powerful development platform that combines the advantages of the C# language and .NET framework. 1) It is widely used in enterprise applications, web development, game development and mobile application development. 2) C# code is compiled into an intermediate language and is executed by the .NET runtime environment, supporting garbage collection, type safety and LINQ queries. 3) Examples of usage include basic console output and advanced LINQ queries. 4) Common errors such as empty references and type conversion errors can be solved through debuggers and logging. 5) Performance optimization suggestions include asynchronous programming and optimization of LINQ queries. 6) Despite the competition, C#.NET maintains its important position through continuous innovation.

The future trends of C#.NET are mainly focused on three aspects: cloud computing, microservices, AI and machine learning integration, and cross-platform development. 1) Cloud computing and microservices: C#.NET optimizes cloud environment performance through the Azure platform and supports the construction of an efficient microservice architecture. 2) Integration of AI and machine learning: With the help of the ML.NET library, C# developers can embed machine learning models in their applications to promote the development of intelligent applications. 3) Cross-platform development: Through .NETCore and .NET5, C# applications can run on Windows, Linux and macOS, expanding the deployment scope.

The latest developments and best practices in C#.NET development include: 1. Asynchronous programming improves application responsiveness, and simplifies non-blocking code using async and await keywords; 2. LINQ provides powerful query functions, efficiently manipulating data through delayed execution and expression trees; 3. Performance optimization suggestions include using asynchronous programming, optimizing LINQ queries, rationally managing memory, improving code readability and maintenance, and writing unit tests.

How to build applications using .NET? Building applications using .NET can be achieved through the following steps: 1) Understand the basics of .NET, including C# language and cross-platform development support; 2) Learn core concepts such as components and working principles of the .NET ecosystem; 3) Master basic and advanced usage, from simple console applications to complex WebAPIs and database operations; 4) Be familiar with common errors and debugging techniques, such as configuration and database connection issues; 5) Application performance optimization and best practices, such as asynchronous programming and caching.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver CS6
Visual web development tools

Atom editor mac version download
The most popular open source editor
