Skip to content

Compilation zh HK

ArchiBot edited this page Nov 18, 2022 · 28 revisions

็ทจ่ญฏ

็ทจ่ญฏๆ˜ฏๅ‰ตๅปบๅฏๅŸท่กŒๆช”็š„้Ž็จ‹ใ€‚ ๅฆ‚ๆžœๆ‚จๆƒณๅฐ‡่‡ชๅทฑ็š„ๆ›ดๆ”นๆทปๅŠ ๅˆฐASF๏ผŒๆˆ–่€…ๅ‡บๆ–ผไปปไฝ•ๅŽŸๅ› ไธไฟกไปปๅฎ˜ๆ–น releases ไธญๆไพ›็š„ๅฏๅŸท่กŒๆช”๏ผŒๅ‰‡้œ€่ฆๅŸท่กŒๆญคๆ“ไฝœใ€‚ ๅฆ‚ๆžœๆ‚จๆ˜ฏๆ™ฎ้€š็”จๆˆถ่€Œไธๆ˜ฏ้–‹็™ผไบบๅ“ก๏ผŒๅ‰‡ๅพˆๅฏ่ƒฝ้œ€่ฆไฝฟ็”จๅทฒ้ ็ทจ่ญฏ็š„ไบŒ้€ฒไฝๆช”ๆกˆ๏ผŒไฝ†ๅฆ‚ๆžœๆ‚จๅธŒๆœ›ไฝฟ็”จ่‡ชๅทฑ็š„ไบŒ้€ฒไฝๆช”ๆกˆ๏ผŒๆˆ–ๅญธ็ฟ’ๆ–ฐๅ…งๅฎน๏ผŒ่ซ‹็นผ็บŒ้–ฑ่ฎ€ใ€‚

ๅช่ฆๆ‚จๆ“ๆœ‰ๆ‰€ๆœ‰้œ€่ฆ็š„ๅทฅๅ…ท๏ผŒ ๅณๅฏไปฅๅœจ็•ถๅ‰ๆ”ฏๆด็š„ไปปไฝ•ๅนณๅฐไธŠ็ทจ่ญฏASFใ€‚


.NET SDK

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 ๅ‘ฝไปคๆ‡‰ๅฏๆญฃๅธธ้‹่กŒใ€‚ ๆ‚จๅฏไปฅ้ฉ—่ญ‰ๅฎƒๆ˜ฏๅฆ้ฉ็”จไบŽ < 0>dotnet-info</0 >ใ€‚ 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 "net7.0" -o "out/generic"

If you're using Linux/macOS, you can instead use cc.sh script which will do the same, in a bit more complex manner.

If compilation ended successfully, you can find your ASF in source flavour in out/generic directory. This is the same as official generic ASF build, but it has forced UpdateChannel and UpdatePeriod of 0, which is appropriate for self-builds.

OS-specific

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 "net7.0" -o "out/linux-x64" -r "linux-x64"

็•ถ็„ถ๏ผŒๆ‚จ้œ€่ฆๅฐ‡ linux-x64 ๆ›ฟๆ›ๆˆๆ‚จ้œ€่ฆ็š„็›ฎๆจ™ๆ“ไฝœ็ณป็ตฑๆžถๆง‹๏ผŒไพ‹ๅฆ‚ win-x64ใ€‚ ้€™ไธ€ๆง‹ๅปบไนŸๅฐ‡็ฆ็”จ่‡ชๅ‹•ๆ›ดๆ–ฐใ€‚

.NET ๆก†ๆžถ

In a very rare case when you'd want to build generic-netf package, you can change target framework from net7.0 to net481. 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 "net481" -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=net481 /p:PublishDir=out/generic-netf /p:ASFNetFramework=true ArchiSteamFarm

ASF-ui

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/macOS, 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 "net7.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**๏ผˆๅ…่ฒป็š„็คพๅ€็‰ˆๅณๅฏ๏ผ‰ใ€‚

If you'd like to work with ASF code on Linux/macOS instead, we recommend latest 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. If you want to compile or reference ASF from source, then you should use appropriate tag for that purpose, which guarantees at least successful compilation, and very likely also flawless execution (if build was marked as stable release). 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.

Clone this wiki locally