一個技術汪的開源夢 —— 基於 .Net Core 的公共組件之目錄結構

一個技術汪的開源夢 —— 目錄html

這篇文章是開源公共組件的開篇那就先說說項目的 Github 目錄結構和 .Net Core 的項目結構。git

1. GitHub 目錄結構和相關文件github

 

 - src 源碼項目目錄。json

 - test 單元測試項目目錄。框架

 - tools 工具目錄。工具

 - .gitignore 你想要忽略的文件或者目錄(一些文件諸如 *.dll、testResults 等 不須要提交到 github 上的文件)詳情:https://git-scm.com/docs/gitignorepost

 - .gitattribute 用於設置文件的對比方式(經常使用非文本文件)詳情:https://git-scm.com/docs/gitattributes單元測試

 

2. 項目解決方案目錄結構和相關文件。測試

 - src/Common 公共類庫。ui

 - src/Common.Abstractions 公共類庫抽象。

 - src/Common.JsonNet.JsonSerializer 公共類庫 Json.Net 組件序列化者。

 - test/Common.JsonNet.JsonSerializer 公共類庫 Json.Net 組件序列化者單元測試。

 - test/Common.Test 公共類庫單元測試。

 

3. ASP.Net Core 類庫項目結構。

 

 - Common.xproj 類庫項目文件。

 - project.json .Net Core 項目新增文件,用於記錄項目的基本信息以及組件依賴等。

 

project.json 文件解析

你們先看一下 Common 這個項目的 project.json 這個文件。

 1 {
 2   "version": "0.1.1-Beta",
 3   "title": "Wlitsoft.Framework.Common",
 4   "copyright": "Wlitsoft 2012 - 2016",
 5   "description": "Wlitsoft 框架 - 公共類庫",
 6   "authors": [ "LILIANG" ],
 7   "language": "zh-CN",
 8   "packOptions": {
 9     "repository": {
10       "type": "git",
11       "url": "git://github.com/wlitsoft/common"
12     },
13     "tags": [
14       "common",
15       "wlitsoft",
16       "framework"
17     ]
18   },
19   "dependencies": {
20     "Common.Abstractions": "0.1.1-Beta",
21     "NETStandard.Library": "1.6.0",
22     "System.Runtime.Serialization.Json": "4.0.2",
23     "System.Xml.XmlSerializer": "4.0.11"
24   },
25   "buildOptions": {
26     "outputName": "Wlitsoft.Framework.Common",
27     "keyFile": "../../tools/Wlitsoft.Framework.snk",
28     "nowarn": [ "CS1591" ],
29     "xmlDoc": true
30   },
31 
32   "frameworks": {
33     "netstandard1.6": {
34       "imports": "dnxcore50"
35     }
36   }
37 }

 解析:

 - version 項目版本號。

 - title 項目名稱。

 - copyright 項目版權信息。

 - description 項目描述。

 - authors 做者。

 - language 語言。

 - packOptions 包的一些定義選項好比倉庫地址、Nutget 包配置等。

 - dependencies 項目的依賴的組件。

 - buildOptions 編譯時的選項。

   - outputName 輸出 dll 的名稱(經常使用)。

   - keyFile 組件簽名文件路徑。

   - xmlDoc 是否輸出 xml 的開關。

更多配置詳見:https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json#packoptions

一個技術汪的開源夢 —— 目錄

相關文章
相關標籤/搜索