Skip to content

Compilation zh HK

JustArchi edited this page Jul 31, 2020 · 28 revisions

็ทจ่ญฏ

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

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


.NET Core SDK

็„ก่ซ–ไฝฟ็”จไป€้บผๅนณๅฐ๏ผŒๆ‚จ้ƒฝ้œ€่ฆๅฎŒๆ•ด็š„ .NET Core SDK๏ผˆไธๅƒ…ๅƒ…ๆ˜ฏ้‹่กŒๆ™‚็’ฐๅขƒ๏ผ‰ๆ‰่ƒฝ็ทจ่ญฏ ASFใ€‚ ๆ‚จๅฏไปฅๅœจ .NET Core ๅฎ‰่ฃ้ ้ขโ€‹ๆ‰พๅˆฐๅฎ‰่ฃๆŒ‡ๅ—ใ€‚ ๆ‚จ้œ€่ฆ็‚บๆ‚จ็š„ๆ“ไฝœ็ณป็ตฑๅฎ‰่ฃ็›ธๆ‡‰็š„.NET Core SDK็‰ˆๆœฌใ€‚ ๆˆๅŠŸๅฎ‰่ฃๅพŒ๏ผŒdotnet ๅ‘ฝไปคๆ‡‰ๅฏๆญฃๅธธ้‹่กŒใ€‚ ๆ‚จๅฏไปฅ้ฉ—่ญ‰ๅฎƒๆ˜ฏๅฆ้ฉ็”จไบŽ < 0>dotnet-info</0 >ใ€‚ ๅŒๆจฃ้œ€่ฆ็ขบ่ชๆ‚จ็š„ .NET Core SDK ๅŒน้… ASF ็š„โ€‹้‹่กŒๆ™‚็’ฐๅขƒ้œ€ๆฑ‚ใ€‚


็ทจ่ญฏ

ๅฆ‚ๆžœๆ‚จๆœ‰ๅˆ้ฉ็‰ˆๆœฌ็š„ .NET Core SDK๏ผŒๅช้œ€ๅฐŽ่ˆชๅˆฐๆบ ASF ็›ฎ้Œ„๏ผˆๅ…‹้š†ๆˆ–ไธ‹่ผ‰ไธฆ่งฃๅฃ“็ธฎ ASF ๅญ˜ๅ„ฒๅบซ๏ผ‰๏ผŒ็„ถๅพŒๅŸท่กŒ๏ผš

dotnet publish ArchiSteamFarm -c "Release" -f "netcoreapp3.1" -o "out/generic"

ๅฆ‚ๆžœๆ‚จๅœจไฝฟ็”จ Linux/OS X๏ผŒๆ‚จไนŸๅฏไปฅไฝฟ็”จ cc.sh ่…ณๆœฌๅฏฆ็พๅŒๆจฃ็š„ๆ•ˆๆžœ๏ผŒๆญค็จฎ็ทจ่ญฏๆ–นๆณ•ๆ–นๅผ็จ่ค‡้›œใ€‚

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

ๅฆ‚ๆžœๆ‚จ้œ€่ฆ๏ผŒไนŸๅฏไปฅ็”Ÿๆˆ็‰นๅฎšๆ“ไฝœ็ณป็ตฑ็š„ .NET Core ๅŒ…ใ€‚ In general you shouldn't do that because you've just compiled generic flavour that you can run with your already-installed .NET Core 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 "netcoreapp3.1" -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 netcoreapp3.1 to net48. ่ซ‹ๆณจๆ„๏ผŒๆ‚จ้œ€่ฆๅˆ้ฉ็š„ **.NET ๆก†ๆžถ**โ€‹้–‹็™ผ่€…ๅทฅๅ…ทๅŒ…ๅ’Œ .NET Core SDK ๆ‰่ƒฝ็ทจ่ญฏ netf ๅŒ…๏ผŒๆ‰€ไปฅๆญคๅ‘ฝไปคๅƒ…้ฉ็”จๆ–ผ Windows๏ผš

dotnet publish ArchiSteamFarm -c "Release" -f "net48" -o "out/generic-netf"

ๅœจ็„กๆณ•ๅฎ‰่ฃ .NET ๆก†ๆžถ็”š่‡ณ .NET Core SDK ๆœฌ่บซ็š„ๆƒ…ๆณไธ‹๏ผˆไพ‹ๅฆ‚ๅœจ linux-x86 ๅนณๅฐ็”จ mono ๆง‹ๅปบ๏ผ‰๏ผŒๅฏไปฅ็›ดๆŽฅ่ชฟ็”จ msbuildใ€‚ ๆ‚จ้‚„้œ€่ฆๆ‰‹ๅ‹•ๆŒ‡ๅฎš ASFNetFramework๏ผŒๅ› ็‚บ ASF ้ ่จญ็ฆๆญขๅœจ้ž WindowsๅนณๅฐไธŠๆง‹ๅปบ netf๏ผš

msbuild /m /r /t:Publish /p:Configuration=Release /p:TargetFramework=net48 /p:PublishDir=out/generic-netf /p:ASFNetFramework=true ArchiSteamFarm

้–‹็™ผ

ๅฆ‚ๆžœๆ‚จๆƒณ่ฆ็ทจ่ผฏ ASF ไปฃ็ขผ๏ผŒๆ‚จๅฏไปฅไฝฟ็”จไปปไฝ•็›ธๅฎน .NET Core ็š„ IDE๏ผŒไฝ†้€™ไนŸๆ˜ฏๅฏ้ธ็š„๏ผŒๅ› ็‚บๆ‚จ็”š่‡ณๅฏไปฅ็”จ่จ˜ไบ‹ๆœฌ็ทจ่ผฏไปฃ็ขผไธฆ็”จไธŠ่ฟฐ dotnet ๆŒ‡ไปค็ทจ่ญฏใ€‚ ไธ้Ž๏ผŒๅฐๆ–ผ Windows ็ณป็ตฑ๏ผŒๆˆ‘ๅ€‘ๆŽจ่–ฆไฝฟ็”จโ€‹**ๆœ€ๆ–ฐ็‰ˆๆœฌ็š„ Visual Studio**๏ผˆๅ…่ฒป็š„็คพๅ€็‰ˆๅณๅฏ๏ผ‰ใ€‚ ๆˆ‘ๅ€‘้‚„ๅปบ่ญฐๆ‚จ้…ๅˆไฝฟ็”จ ReSharper๏ผˆๅฏ้ธ๏ผ‰๏ผŒไฝ†ๅฎƒไธๆ˜ฏไธ€ๅ€‹ๅ…่ฒป่ปŸไปถใ€‚

ๅฆ‚ๆžœๆ‚จ่ฆๅœจ Linux/OS X ไธŠ้–‹็™ผ ASF ไปฃ็ขผ๏ผŒๆˆ‘ๅ€‘ๆŽจ่–ฆไฝฟ็”จโ€‹**ๆœ€ๆ–ฐ็‰ˆ็š„ Visual Studio Code**ใ€‚ ๅฎƒๆฒ’ๆœ‰็ถ“ๅ…ธ็š„ Visual Studio ้‚ฃ้บผ่ฑๅฏŒ็š„ๅŠŸ่ƒฝ๏ผŒไฝ†ๅทฒ่ถณๅค ไบ†ใ€‚

็•ถ็„ถ๏ผŒไปฅไธŠ็š„ๆ‰€ๆœ‰ๅปบ่ญฐ้ƒฝๅƒ…ๅƒ…ๆ˜ฏๅปบ่ญฐ๏ผŒๆ‚จๅฏไปฅไฝฟ็”จๆ‚จๆƒณ็”จ็š„ไปปไฝ•ๅทฅๅ…ท๏ผŒๆœ€ๅพŒๆ‚จ้ƒฝ่ฆไฝฟ็”จ dotnet build ๅ‘ฝไปค้€ฒ่กŒๆง‹ๅปบใ€‚ ๆˆ‘ๅ€‘ไฝฟ็”จ Visual Studio + ReSharper ้€ฒ่กŒ ASF ็š„้–‹็™ผ๏ผŒไนŸไฝฟ็”จไบ†ไธ€้ƒจๅˆ†็ฌฌไธ‰ๆ–นๅทฅๅ…ท๏ผŒๆ‚จๅฏไปฅๅœจrepo็š„ tools ็›ฎ้Œ„ไธญๆ‰พๅˆฐๅฎƒๅ€‘ใ€‚


ๆจ™็ฑค

master ๅˆ†ๆ”ฏไธฆไธไฟ่ญ‰่ƒฝๅค ๆˆๅŠŸ็ทจ่ญฏๆˆ–่€…ๆญฃๅธธ้‹่กŒ ASF๏ผŒๆญฃๅฆ‚ๆˆ‘ๅ€‘ๅœจโ€‹**็™ผไฝˆๅ‘จๆœŸโ€‹ไธญๆ‰€่ฟฐ๏ผŒ้€™ๆ˜ฏไธ€ๅ€‹้–‹็™ผๅˆ†ๆ”ฏใ€‚ 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). ๆ‚จๅฏไปฅ้€š้ŽๆชขๆŸฅๆˆ‘ๅ€‘็š„ CIโ€”โ€”AppVeyor** ๆˆ– **Travis**ไปฅไบ†่งฃไปฃ็ขผๅบซ็พๆ™‚็š„โ€œๅฅๅบท็‹€ๆ…‹โ€ใ€‚


ๅฎ˜ๆ–น็™ผไฝˆ็‰ˆๆœฌ

ๅฎ˜ๆ–น ASF ็™ผไฝˆ็‰ˆๆœฌ็”ฑ Windows ไธŠ็š„ๅธถๆœ‰ๆปฟ่ถณ ASF **้‹่กŒๆ™‚็’ฐๅขƒ้œ€ๆฑ‚**โ€‹็š„ๆœ€ๆ–ฐ็‰ˆ .NET Core SDK ็š„ AppVeyor ็ทจ่ญฏใ€‚ ็ถ“ๆธฌ่ฉฆๅพŒ๏ผŒๆ‰€ๆœ‰็š„ๅŒ…้ƒฝๆœƒ่ขซ้ƒจ็ฝฒๅœจ GitHub ไธŠใ€‚ ้€™ไนŸไฟ่ญ‰ไบ†้€ๆ˜Žๅบฆ๏ผŒๅ› ็‚บ AppVeyor ็ธฝๆ˜ฏ็‚บๆ‰€ๆœ‰ๆง‹ๅปบไฝฟ็”จๅฎ˜ๆ–นๅ…ฌๅ…ฑๆบ๏ผŒไธฆไธ”ๆ‚จๅฏไปฅๆชขๆŸฅ AppVeyor ็š„ Artifacts ่ˆ‡ GitHub ้™„ไปถ็š„ Checksum๏ผˆๆ ก้ฉ—ๅ’Œ๏ผ‰ใ€‚ ้™คไบ†็งไบบ็š„้–‹็™ผๅ’Œ่ชฟ่ฉฆ้Ž็จ‹ๅค–๏ผŒASF ้–‹็™ผไบบๅ“กไธๆœƒ่‡ช่กŒ็ทจ่ญฏๆˆ–็™ผไฝˆๆง‹ๅปบ็‰ˆๆœฌใ€‚

Clone this wiki locally