How to compile an ASP.NET project in the command line

xiaoxiao2021-03-06  14

Many cases you downloaded the source program from the Internet, but you didn't have the development environment without the development environment and you can't compile. Here I simply say a solution.

The source program is preferably .csproj or .vbproj file, no words, I have to take some time to debug the example of VB.NET to explain:

From Proj we can get the following useful information

There are many configuration options in the Settings section. Corresponding to some compiler options Section is a reference to the project, the third party library is best to use the absolute path section is some namespace to import section All files with the project, select the file of buildAction = "compile"

Tested with VBC, it is easy, pay attention to the following: rootnamespacereferencenAncetimports

Plus BugReport can output all source file code and bug report. Nice

Give you one end to compile example: vbc /r:system.dll /r:system.data.dll /r:system.drawing.dll /r:System.Web.dll /R:System.xml.dll / r: bin / Microsoft.ApplicationBlocks.Data.dll /r:bin/ExportTechnologies.WebControls.RTE.dll /imports:Microsoft.VisualBasic / imports: System /imports:System.Collections /imports:System.Configuration /imports:System.Data / imports: System.Drawing /imports:System.Web /imports:System.Web.UI /imports:System.Web.UI.HtmlControls /imports:System.Web.UI.WebControls / imports: MMS / rootnamespace: MMS / t: library / Out: truly.mms.dll /bugreport:bug.log assemblyinfo.vb global.asax.vb hdadd.aspx.vb hdticketlogadd.aspx.vb mis.vb PageBase.vb utils.vb

If there is no Proj file, you can get DIR / B * .vb> filelist.txt

The method of use of CSC rely on yourself.

This is one point difference with VS, because many of our options are not configured, but after testing, it is basically working properly.

You can write an Application based on this theory to take a few minutes, automatically use the CSC program to help you compile the project.

Supplementary description: 1. Need to download the DOTNET SDK to get the compiler (free) 2. Some netizens reflect this method complicated, in fact, the above strings are generated with the DOS command, for the web project contains subdictions, You can generate: DIR / B / S * .vb> fileList.txt, then open with text editor, use the replacement (select Regular Replace) to replace "/ N" to ",", ok, basically Generate a full file list, you can get a compiled instructions slightly modified.

转载请注明原文地址:https://www.9cbs.com/read-49226.html

New Post(0)