码迷,mamicode.com
首页 > Windows程序 > 详细

如何编译C#的web项目 (C# Compilation Scripts)

时间:2016-12-15 14:20:50      阅读:333      评论:0      收藏:0      [点我收藏+]

标签:sax   project   rem   ram   如何   director   dll   pts   定义   

                                         本人只是新手,学博客只是只是用于记录学习的点点滴滴,写的不好,多多包涵。

 

一,如何用batch文件compile C# web Project。

     1.新建bat文件,这里是一个例子。

 

@ECHO OFF

REM ****************************************************************************
REM SET ALL ENVIRONMENT HERE
REM ****************************************************************************
@ECHO SETTING ENVIRONMENTS
rem SET FRAMEWORKROOT=%systemroot%\microsoft.net\framework\v4.0.30319           
SET FRAMEWORKROOT=C:\Windows\Microsoft.NET\Framework\v4.0.30319
set path=%path%;%FRAMEWORKROOT%
set BEOUTPUTPATH=C:\MobileOne\M1TechnicalInterface
rem set CrystalReport="C:\Program Files\Common Files\Crystal Decisions\1.1\Managed"   
set FASCADE_OUTPUTPATH=C:\MobileOne\M1TechnicalInterface
set OUTPUTPATH=D:\Compilation\Output\AddressLabel\CAL
rem set OUTPUTPATH=C:\MobileOne\output
set OUTNAME=CAL
REM common reference E:\M1TechnicalInterface\bin

rem SET AJAXEXTENTION=C:/"Program Files"/"Microsoft ASP.NET"/"ASP.NET 2.0 AJAX Extensions"/v1.0.61025/System.Web.Extensions.dll 
rem set AJAXCONTROL=%OUTPUTPATH%\%OUTNAME%\bin\AjaxControlToolkit.dll
set Common=%OUTPUTPATH%\bin\Common.dll
rem set Oracle=%OUTPUTPATH%\bin\Oracle.DataAccess.dll
SET WSREFERENCE=%Common%,%Oracle%
rem SET WSREFERENCE=%AJAXCONTROL%




REM ****************************************************************************
REM REMOVE ALL OLD FILES
REM ****************************************************************************
@ECHO REMOVING EXISTING COMPILAION OUTPUT
@ECHO REMOVING DIRECTIORY %OUTPUTPATH%
rem rmdir /S /Q %OUTPUTPATH%
rmdir /S /Q %OUTPUTPATH%


REM ****************************************************************************
REM CREATING ALL NEW DIRECTORIES TO STORE OUTPUT
REM ****************************************************************************
@ECHO CREATING NEW DIRECTORIES

REM make PSFrontEnd folder
mkdir   %OUTPUTPATH%
if not "%ERRORLEVEL%" == "0" GOTO :ERROR
rem This directory is not needed for PS
rem mkdir %OUTPUTPATH%\bin
rem if not "%ERRORLEVEL%" == "0" GOTO :ERROR



@ECHO COMPILING %OUTPUTPATH% LIBRARY

mkdir %OUTPUTPATH%\bin
if not "%ERRORLEVEL%" == "0" GOTO :ERROR

mkdir %OUTPUTPATH%\images
if not "%ERRORLEVEL%" == "0" GOTO :ERROR

mkdir %OUTPUTPATH%\Css
if not "%ERRORLEVEL%" == "0" GOTO :ERROR

mkdir %OUTPUTPATH%\Properties
if not "%ERRORLEVEL%" == "0" GOTO :ERROR

mkdir %OUTPUTPATH%\scripts
if not "%ERRORLEVEL%" == "0" GOTO :ERROR


copy *.aspx %OUTPUTPATH%
copy *.asax %OUTPUTPATH%
copy *.ascx %OUTPUTPATH%
copy *.config %OUTPUTPATH%
copy *.css %OUTPUTPATH%
copy *.js %OUTPUTPATH%
copy *.xml %OUTPUTPATH%
copy *.html %OUTPUTPATH%
copy *.htm %OUTPUTPATH%
copy *.Master %OUTPUTPATH%
copy bin\*.dll %OUTPUTPATH%\bin
copy images\*.* %OUTPUTPATH%\images 
copy Css\*.* %OUTPUTPATH%\Css 
copy scripts\*.* %OUTPUTPATH%\scripts
copy Properties\*.Settings.settings %OUTPUTPATH%\Properties 

@ECHO.
@ECHO -------------------------------------------------------------
@ECHO.

rem csc /nologo /t:library  /out:%OUTPUTPATH%\bin\%OUTNAME%.dll  *.cs "Web References"\Customer\*.cs "Web References"\SingleSignOnServiceFacade\*.cs "Service References"\Voucher\*.cs "Web References"\SMS\*.cs "Web References"\DASTranLog\*.cs "Properties"\*.cs "Service References"\CAMBFC\*.cs "Service References"\CommonBFC\*.cs "Service References"\Offer\*.cs 
csc /nologo /t:library /r:%OUTPUTPATH%\bin\Common.dll /r:%WSREFERENCE% /out:%OUTPUTPATH%\bin\%OUTNAME%.dll  *.cs "BusinessLogic"\*.cs "Properties"\*.cs "Service References"\InboundCAMBFCService\*.cs "Web References"\ServiceFacada\*.cs "Models"\*.cs



if not "%ERRORLEVEL%" == "0" GOTO :ERROR

@ECHO.
@ECHO -------------------------------------------------------------
@ECHO.

@ECHO WEB SERVICES COMPILATION SUCCESSFUL
GOTO :END

:ERROR
@ECHO COMPILATION FAILED


:END

PAUSE

 2. Explanation of bat command

@ECHO  显示打印信息
SET FRAMEWORKROOT=C:\Windows\Microsoft.NET\Framework\v4.0.30319   设置你的Framework的compiler路径。
SET path=%path%;%FRAMEWORKROOT%
SET Common=%OUTPUTPATH%\bin\Common.dll    设置你项目的reference
csc /nologo /t:library /r:%OUTPUTPATH%\bin\Common.dll /r:%WSREFERENCE% /out:%OUTPUTPATH%\bin\%OUTNAME%.dll  *.cs "BusinessLogic"\*.cs "Properties"\*.cs "Service References"\InboundCAMBFCService\*.cs "Web References"\ServiceFacada\*.cs "Models"\*.cs

开始compile, /t:library  compile完成生成dll文件  /r:添加你的reference  /out: 输出dll文件
"BusinessLogic"\*.cs 定义你项目里的cs文件
 

 

 

 

  

 

 

         

如何编译C#的web项目 (C# Compilation Scripts)

标签:sax   project   rem   ram   如何   director   dll   pts   定义   

原文地址:http://www.cnblogs.com/skycoder/p/6182819.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!