-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compilation zh TW
編譯是建立執行檔的過程。 如果您想將自己的變更添加到ASF,或者出於任何原因不信任官方 releases 中提供的可執行檔,則需要執行此操作。 如果您是使用者而不是開發人員,則很可能需要使用已預編譯的二進位檔案,但如果您希望使用自己的二進位檔案或學習新內容,請繼續閱讀。
只要您擁有所有需要的工具,即可以在任何當前支援的平台上編譯ASF。
Regardless of platform, you need full .NET SDK (not just runtime) in order to compile ASF. Installation instructions can be found on .NET download page. You need to install appropriate .NET SDK version for your OS. 成功安裝後,dotnet
指令應可正常執行。 您可以執行 dotnet --info
指令以驗證。 Also ensure that your .NET SDK matches ASF runtime requirements.
Assuming you have .NET SDK operative and in appropriate version, simply navigate to source ASF directory (cloned or downloaded and unpacked ASF repo) and execute:
dotnet publish ArchiSteamFarm -c "Release" -f "net6.0" -o "out/generic"
如果您在使用 Linux/OS X,您也可以使用 cc.sh
腳本實現同樣的效果,此種編譯方法方式稍複雜。
如果編譯成功完成,您可以在 out/generic
目錄中找到您的 ASF source
套件。 這與 ASF 官方的 通用(Generic)
建置相同,但因為這是您自己建置的,所以它強制設定 UpdateChannel
和 UpdatePeriod
為 0
。
You can also generate OS-specific .NET package if you have a specific need. In general you shouldn't do that because you've just compiled generic
flavour that you can run with your already-installed .NET runtime that you've used for the compilation in the first place, but just in case you want to:
dotnet publish ArchiSteamFarm -c "Release" -f "net6.0" -o "out/linux-x64" -r "linux-x64"
當然,您需要將 linux-x64
替換成您需要的目標作業系統架構,例如 win-x64
。 這一構建也將停用自動更新。
In a very rare case when you'd want to build generic-netf
package, you can change target framework from net6.0
to net48
. Keep in mind that you'll need appropriate .NET Framework developer pack for compiling netf
variant, in addition to .NET SDK, so the below will work only on Windows:
dotnet publish ArchiSteamFarm -c "Release" -f "net48" -o "out/generic-netf"
In case of being unable to install .NET Framework or even .NET SDK itself (e.g. because of building on linux-x86
with mono
), you can call msbuild
directly. You'll also need to specify ASFNetFramework
manually, as ASF by default disables netf
build on non-Windows platforms:
msbuild /m /r /t:Publish /p:Configuration=Release /p:TargetFramework=net48 /p:PublishDir=out/generic-netf /p:ASFNetFramework=true ArchiSteamFarm
While the above steps are everything that is required to have a fully working build of ASF, you may also be interested in building ASF-ui, our graphical web interface. From ASF side, all you need to do is dropping ASF-ui build output in standard ASF-ui/dist
location, then building ASF with it (again, if needed).
ASF-ui is part of ASF's source tree as a git submodule, ensure that you've cloned the repo with git clone --recursive
, as otherwise you'll not have the required files. You'll also need a working NPM, Node.js comes with it. If you're using Linux/OS X, we recommend our cc.sh
script, which will automatically cover building and shipping ASF-ui (if possible, that is, if you're meeting the requirements we've just mentioned).
In addition to the cc.sh
script, we also attach the simplified build instructions below, refer to ASF-ui repo for additional documentation. From ASF's source tree location, so as above, execute the following commands:
rm -rf "ASF-ui/dist" # ASF-ui doesn't clean itself after old build
npm ci --prefix ASF-ui
npm run-script deploy --prefix ASF-ui
rm -rf "out/generic/www" # Ensure that our build output is clean of the old files
dotnet publish ArchiSteamFarm -c "Release" -f "net6.0" -o "out/generic" # Or accordingly to what you need as per the above
You should now be able to find the ASF-ui files in your out/generic/www
folder. ASF will be able to serve those files to your browser.
Alternatively, you can simply build ASF-ui, whether manually or with the help of our repo, then copy the build output over to ${OUT}/www
folder manually, where ${OUT}
is the output folder of ASF that you've specified with -o
parameter. This is exactly what ASF is doing as part of the build process, it copies ASF-ui/dist
(if exists) over to ${OUT}/www
, nothing fancy.
If you'd like to edit ASF code, you can use any .NET compatible IDE for that purpose, although even that is optional, since you can as well edit with a notepad and compile with dotnet
command described above. 不過,對於 Windows 系統,我們推薦使用**最新版本的 Visual Studio**(免費的社區版即可)。
如果您要在 Linux/OS X 上開發 ASF 程式碼,我們推薦使用**最新版的 Visual Studio Code**。 它沒有經典的 Visual Studio 那麼豐富的功能,但已足夠了。
當然,以上的所有建議都僅僅是建議,您可以使用您想用的任何工具,最後您都要使用 dotnet build
指令進行構建。 We use JetBrains Rider for ASF development, although it's not a free solution.
main
branch is not guaranteed to be in a state that allows successful compilation or flawless ASF execution in the first place, since it's development branch just like stated in our release cycle. 如果您希望從原始碼編譯或參照 ASF,就應該為此選擇適當的**標籤**,這樣能夠保證編譯成功,甚至可以正常運行(如果您選擇穩定版)。 In order to check the current "health" of the tree, you can use our CI - GitHub.
Official ASF releases are compiled by GitHub on Windows, with latest .NET SDK that matches ASF runtime requirements. After passing tests, all packages are deployed as the release, also on GitHub. This also guarantees transparency, since GitHub always uses official public source for all builds, and you can compare checksums of GitHub artifacts with GitHub release assets. 除了私人的開發和調試過程外,ASF 開發人員不會自行編譯或發佈構建版本。
Starting from ASF V5.2.0.5, in addition to the above, ASF maintainers manually validate and publish build checksums on independent from GitHub, remote server, as additional security measure. This step is mandatory for existing ASFs to consider the release as a valid candidate for auto-update functionality.