自动化每日构建(三)用NAnt来完成.NET工程的每日构建

2023-10-28 13:18

本文主要是介绍自动化每日构建(三)用NAnt来完成.NET工程的每日构建,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

过去写的文章,不过是英文的。后面有附带的 project.build 文件,你可以用项目的名称替换调******,并且加上代码更新,单元测试等具体内容,就可以做每日构建了。

 

Start a new .NET project by using Nant

 

This document has 5 sections:

Brief

System requirement

Directories and files

The Build file

Run Nant

 

 

Brief

Start a new .NET project by using Nant, so we can make Daily Building. All have to do list below:

1.Install .NET SDK1.0 and new version Nant, and make Nant works.

2.Copy Directories and files from nproject(n for .NET) template library.

3.Make project files stay in the right directory.

4.Edit the project.Build file. Let it fit the project.

5.Run Nant.

 

 

System requirement

.NET SDK1.0 or higher

Nant 0.84 or higher

 

Directories and files

You can make directories yourself, or copy from template. But make sure the directory tree like this:

Every directory is made for a certain kind of files. Directory names and what kind of files should be put in list below:

Directory        Files should be put in

            Build                building files

            Data                 project’s data files

            Doc                  project‘s documents for installation and deploying

            Lib                   libraries project depending on

            Res                  resources project using

                        Install               resources for installation

            Src                   project’ source files

                        Config              project’s configuration files

                        Database          project’s database files

                        cs                     project’s c# source code files

                        Docs                project’s documents for manager, developer, tester

                        Scripts              project’s script files

                        Sql                   project’s script files for database

           

Now put the .NET files into the /src/cs directory.

 

The Build file

            The build file is /build/project.build. In the template we already have a default build file. Because every project has different name and configuration, so we must edit the build file to suit project. We must edit the project name and path in the build file.

 

Run Nant

            After doing that, now start a command-line prompt, change path to ./build, and type nant. We can see a function list like this:

Now Nant runs. We can EDIT the build file to add new features: unit testing, packing, deploying, etc, as you like.

 

project.build 文件内容:

<?xml version="1.0" ?>
<project default="usage" basedir=".">
    <echo message="Using '${nant.settings.currentframework}' framework on '${nant.platform.name}' platform."/>

    <!-- =================================================================== -->
    <!-- Initialization target                                               -->
    <!-- =================================================================== -->
    <target name="init">
        <!-- You have to fill the ***** space with your project label.  -->
        <property name="Name" value="*****"/>
        <property name="name" value="*****"/>
     <property name="version" value="1.0" overwrite="false" />

     <echo message="------------------ ${Name}${version} Build  ------------------"/>

        <property name="s.home" value=".."/>
        <property name="s.src" value="${s.home}/src"/>
        <property name="s.srccs" value="${s.home}/src/cs"/>
        <property name="s.gohome" value="../"/>
        <property name="s.lib" value="${s.home}/lib"/>
        <property name="s.res" value="${s.home}/res"/>
        <property name="s.build" value="${s.home}/build"/>
        <property name="s.run" value="${s.home}/run"/>

        <property name="s.build.assemble" value="${s.build}/assemble"/>
        <property name="s.build.bin" value="${s.build.assemble}/bin"/>
        <property name="s.build.debug" value="${s.build.bin}/debug"/>
        <property name="s.build.gensrc" value="${s.build.assemble}/gen-src"/>
        <property name="s.build.apidocs" value="${s.build}/apidocs"/>
        <property name="s.build.lib" value="${s.home}/res"/>
        <property name="s.build.release" value="${s.build}/release"/>
        <property name="s.build.web"   value="${s.build}/web"/>
        <property name="s.build.dist"  value="${s.build}/dist"/>
        <property name="s.main" value="com"/>

        <tstamp>
            <format property="TODAY" pattern="d-MM-yy"/>
        </tstamp>

    </target>
    

    <!-- =================================================================== -->
    <!-- Help on usage                                                       -->
    <!-- =================================================================== -->
    <target name="usage">
        <echo message=""/>
        <echo message=""/>
        <echo message="***** Build file"/>
        <echo message="-------------------------------------------------------------"/>
        <echo message=""/>
        <echo message=" available targets are:"/>
        <echo message=""/>
        <echo message="   package   --> generates the *****.zip file (default)"/>
        <echo message="   compile   --> compiles the source code"/>
        <echo message="   test      --> unit test"/>
        <echo message="   release   --> build the installation package"/>
        <echo message="   deploy    --> deploy the application"/>
        <echo message="   clean     --> cleans up the directory"/>
        <echo message=""/>
        <echo message=" See the comments inside the *.build file for more details."/>
        <echo message="-------------------------------------------------------------"/>
        <echo message=""/>
        <echo message=""/>
    </target>
   
    <!-- =================================================================== -->
    <!-- Compiles the source directory                                       -->
    <!-- =================================================================== -->
    <target name="compile" depends="init">
        <mkdir dir="${s.build.bin}"/>
        <echo message=""/>
        <echo message="Compiling application main source..."/>
        <echo message="${s.srccs}/${name}/*.cs"/>

        <!-- You may change the compile tasks here.  -->
    
  <!-- first compile way: using solution task  -->
      <solution configuration="release" solutionfile="${s.srccs}/${name}/${name}.sln"
          outputdir="${s.build.bin}" />

  <!-- second compile way: using csc task for c# file  -->
  <!--
        <csc target="exe" warnaserror="true" debug="${debug}"
             output="${s.build.bin}/${name}.exe" >
            <sources failonempty="true">
                <includes name="${s.srccs}/${name}/*.cs" />
            </sources>
        </csc>  
        -->
       
    </target>
        


    <!-- =================================================================== -->
    <!-- Creates the zip package                                             -->
    <!-- =================================================================== -->
    <target name="package" depends="compile">

        <!-- You may change the package tasks here.  -->

    </target>


    <!-- =================================================================== -->
    <!-- Creates the deploy                                                  -->
    <!-- =================================================================== -->
    <target name="test" depends="compile">
   
  <!-- You may fill the tasks here.  -->
  
    </target>


    <!-- =================================================================== -->
    <!-- Creates the deploy                                                  -->
    <!-- =================================================================== -->
    <target name="deploy" depends="">
   
  <!-- You may fill the tasks here.  -->
  
    </target>

 

    <!-- =================================================================== -->
    <!-- Build the installation packge                                       -->
    <!-- =================================================================== -->
    <target name="release" depends="clean">
   
  <!-- You may fill the tasks here.  -->
  
    </target>

 

    <!-- =================================================================== -->
    <!-- Clean targets                                                       -->
    <!-- =================================================================== -->
    <target name="clean" depends="init">
        <delete dir="${s.build.assemble}"/>
        <delete dir="${s.build.release}"/>
       
  <!-- You may fill the tasks here.  -->
  
    </target>

   
</project>

<!-- End of file -->
   
    

这篇关于自动化每日构建(三)用NAnt来完成.NET工程的每日构建的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/293469

相关文章

Python中构建终端应用界面利器Blessed模块的使用

《Python中构建终端应用界面利器Blessed模块的使用》Blessed库作为一个轻量级且功能强大的解决方案,开始在开发者中赢得口碑,今天,我们就一起来探索一下它是如何让终端UI开发变得轻松而高... 目录一、安装与配置:简单、快速、无障碍二、基本功能:从彩色文本到动态交互1. 显示基本内容2. 创建链

Golang使用etcd构建分布式锁的示例分享

《Golang使用etcd构建分布式锁的示例分享》在本教程中,我们将学习如何使用Go和etcd构建分布式锁系统,分布式锁系统对于管理对分布式系统中共享资源的并发访问至关重要,它有助于维护一致性,防止竞... 目录引言环境准备新建Go项目实现加锁和解锁功能测试分布式锁重构实现失败重试总结引言我们将使用Go作

Jenkins中自动化部署Spring Boot项目的全过程

《Jenkins中自动化部署SpringBoot项目的全过程》:本文主要介绍如何使用Jenkins从Git仓库拉取SpringBoot项目并进行自动化部署,通过配置Jenkins任务,实现项目的... 目录准备工作启动 Jenkins配置 Jenkins创建及配置任务源码管理构建触发器构建构建后操作构建任务

.NET利用C#字节流动态操作Excel文件

《.NET利用C#字节流动态操作Excel文件》在.NET开发中,通过字节流动态操作Excel文件提供了一种高效且灵活的方式处理数据,本文将演示如何在.NET平台使用C#通过字节流创建,读取,编辑及保... 目录用C#创建并保存Excel工作簿为字节流用C#通过字节流直接读取Excel文件数据用C#通过字节

Ilya-AI分享的他在OpenAI学习到的15个提示工程技巧

Ilya(不是本人,claude AI)在社交媒体上分享了他在OpenAI学习到的15个Prompt撰写技巧。 以下是详细的内容: 提示精确化:在编写提示时,力求表达清晰准确。清楚地阐述任务需求和概念定义至关重要。例:不用"分析文本",而用"判断这段话的情感倾向:积极、消极还是中性"。 快速迭代:善于快速连续调整提示。熟练的提示工程师能够灵活地进行多轮优化。例:从"总结文章"到"用

嵌入式QT开发:构建高效智能的嵌入式系统

摘要: 本文深入探讨了嵌入式 QT 相关的各个方面。从 QT 框架的基础架构和核心概念出发,详细阐述了其在嵌入式环境中的优势与特点。文中分析了嵌入式 QT 的开发环境搭建过程,包括交叉编译工具链的配置等关键步骤。进一步探讨了嵌入式 QT 的界面设计与开发,涵盖了从基本控件的使用到复杂界面布局的构建。同时也深入研究了信号与槽机制在嵌入式系统中的应用,以及嵌入式 QT 与硬件设备的交互,包括输入输出设

Retrieval-based-Voice-Conversion-WebUI模型构建指南

一、模型介绍 Retrieval-based-Voice-Conversion-WebUI(简称 RVC)模型是一个基于 VITS(Variational Inference with adversarial learning for end-to-end Text-to-Speech)的简单易用的语音转换框架。 具有以下特点 简单易用:RVC 模型通过简单易用的网页界面,使得用户无需深入了

poj 1258 Agri-Net(最小生成树模板代码)

感觉用这题来当模板更适合。 题意就是给你邻接矩阵求最小生成树啦。~ prim代码:效率很高。172k...0ms。 #include<stdio.h>#include<algorithm>using namespace std;const int MaxN = 101;const int INF = 0x3f3f3f3f;int g[MaxN][MaxN];int n

如何在Visual Studio中调试.NET源码

今天偶然在看别人代码时,发现在他的代码里使用了Any判断List<T>是否为空。 我一般的做法是先判断是否为null,再判断Count。 看了一下Count的源码如下: 1 [__DynamicallyInvokable]2 public int Count3 {4 [__DynamicallyInvokable]5 get

2、PF-Net点云补全

2、PF-Net 点云补全 PF-Net论文链接:PF-Net PF-Net (Point Fractal Network for 3D Point Cloud Completion)是一种专门为三维点云补全设计的深度学习模型。点云补全实际上和图片补全是一个逻辑,都是采用GAN模型的思想来进行补全,在图片补全中,将部分像素点删除并且标记,然后卷积特征提取预测、判别器判别,来训练模型,生成的像