README initial commit, for now - windows only

This commit is contained in:
Fasjeit 2020-02-06 10:41:13 +03:00
Родитель 12db56440b
Коммит e8df9f074f
1 изменённых файлов: 114 добавлений и 1 удалений

115
README.md
Просмотреть файл

@ -1,2 +1,115 @@
# DotnetCoreSampleProject
Sample Project for Dotnet Core
Ïðèìåð ïðîåêòà Dotnet Core ñ ðåàëèçàöèåé ÃÎÑÒ êðèïòîãðàôèè.
## Ñáîðêà ïðîåêòà áåç ñáîðêè corefx äëÿ Windows
Äëÿ ñáîðêè ïðîåêòà íåîáõîäèìî âûïîëíèòü ñëåäóþùèå äåéñòâèÿ:
1. Óñòàíîâèòü ÊðèïòîÏðî CSP 5.0. Óáåäèòüñÿ ÷òî ââåäåíà äåéñòâóþùàÿ ëèöåíçèÿ.
2. Óñòàíîâèòü ïîñëåäíþþ âåðñèþ [core 3.1 sdk è runtime](https://dotnet.microsoft.com/download) .
3. Çàäàòü ïåðåìåííóþ ñðåäû DOTNET_MULTILEVEL_LOOKUP=0.
4. Ñêà÷àòü àðõèâ [packages](https://ci.appveyor.com/project/CryptoProLLC/corefx/build/artifacts) è ðàçàðõèâèðîâàòü åãî â ïàïêó packages ïî íåêîòîðîìó ïóòè `packages_PATH`.
5. Ñêà÷àòü àðõèâ [runtime](https://ci.appveyor.com/project/CryptoProLLC/corefx/build/artifacts) è è ðàçàðõèâèðîâàòü åãî â ïàïêó runtime ïî íåêîòîðîìó ïóòè `runtime_PATH`.
6. Èçìåíèòü ôàéë %appdata%\NuGet\NuGet.Config, äîáàâèâ â íà÷àëî óçëà `packageSources` èñòî÷íèê `<add key="local coreclr" value="packages_PATH\Debug\NonShipping" />`.
Ïðèìåð:
```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="local coreclr" value="C:\packages\Debug\NonShipping" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
```
7. Ñêîïèðîâàòü ñáîðêè NetStandard â ëîêàëüíóþ äèðåêòîðèþ nuget (`$env:userprofile\.nuget\packages\`) ñ çàìåíîé.
Ïðèìåð powershell ñêðèïòà, âûïîëíÿþùåãî äàííóþ îïåðàöèþ
```powershell
git clone https://github.com/CryptoProLLC/NetStandard.Library
New-Item -ItemType Directory -Force -Path "$env:userprofile\.nuget\packages\netstandard.library"
Copy-Item -Force -Recurse ".\NetStandard.Library\nugetReady\netstandard.library" -Destination "$env:userprofile\.nuget\packages\"
```
8. Âûêà÷àòü ëîêàëüíî ðåïîçèòîðèé òåêóùåãî ïðîåêòà.
```powershell
git clone https://github.com/CryptoProLLC/DotnetCoreSampleProject
```
9. Èçìåíèòü ôàéë DotnetSampleProject.csproj, óêàçàâ ïðàâèëüíûå ïóòè äî ñáîðîê `System.Security.Cryptography.Pkcs.dll` è `System.Security.Cryptography.Xml.dll`, óêàçàâ â êà÷åñòâå ïóòè
`packages_PATH`.
Ïðèìåð:
```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<!-- make self-contained -->
<PackageConflictPreferredPackages>Microsoft.Private.CoreFx.NETCoreApp;runtime.win-x64.Microsoft.Private.CoreFx.NETCoreApp;$(PackageConflictPreferredPackages)</PackageConflictPreferredPackages>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Private.CoreFx.NETCoreApp" Version="4.7.0-dev.20065.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Security.Cryptography.Pkcs">
<HintPath>C:\runtime\System.Security.Cryptography.Pkcs.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Xml">
<HintPath>C:\runtime\System.Security.Cryptography.Xml.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
```
10. Ïåðåéòè â ïàïêó ïðîåêòà. Âîññòàíîâèòü çàâèñèìîñòè è ñîáðàòü ïðîåêò. Çàïóñòèòü ïîëó÷åííûé ïðîåêò.
```powershell
cd DotnetCoreSampleProject
dotnet restore
dotnet build
dotnet run
```
## Ñáîðêà ïðîåêòà ñî ñáîðêîé corefx äëÿ Windows
1. Âûïîëíèòü øàãè 1-3 èç "Ñáîðêà ïðîåêòà áåç ñáîðêè corefx".
2. Âûêà÷àòü ðåïîçèòîðèé [corefx](https://github.com/CryptoProLLC/corefx/).
3. Âûïîëíèòü ñáîðêó corefx, ïåðåéäÿ â ëîêàëüíóþ ïàïêó ðåïîçèòîðèÿ è âûïîëíèâ `build.cmd`.
4. Âûïîëíèòü øàã 6 èç "Ñáîðêà ïðîåêòà áåç ñáîðêè corefx", èñïîëüçîâàâ â êà÷åñòâå ïóòè
`packages_PATH` ïóòü âèäà `corefx_PATH\artifacts\packages`, ãäå `corefx_PATH` ïóòü äî ëîêàëüíîé ïàïêè ðåïîçèòîðèÿ corefx.
5. Âûïîëíèòü øàãè 7-10 èç "Ñáîðêà ïðîåêòà áåç ñáîðêè corefx", èñïîëüçîâàâ â êà÷åñòâå ïóòè
`packages_PATH` ïóòü âèäà `corefx_PATH\artifacts\packages`, ãäå `corefx_PATH` ïóòü äî ëîêàëüíîé ïàïêè ðåïîçèòîðèÿ corefx.
 ñëó÷àå âíåñåíèÿ èçìåíåíèé â ðåïîçèòîðèé corefx, ïåðåä åãî ñáîðêîé íåîáõîäèìî î÷èñòèòü ïàïêè
`%userprofile%\.nuget\packages\microsoft.private.corefx.netcoreapp`, `%userprofile%\.nuget\packages\runtime.win-x64.microsoft.private.corefx.netcoreapp`, `corefx_PATH\artifacts\packages`
ïîñëå ÷åãî çàâåðøèòü âñå ïðîöåññû dotnet core.
Ïðèìåð ñêðèïòà âûïîëíÿþùåãî äàííîå äåéñòâèå
```powershell
taskkill /im dotnet.exe /f
rmdir /S /Q %userprofile%\.nuget\packages\microsoft.private.corefx.netcoreapp
rmdir /S /Q %userprofile%\.nuget\packages\runtime.win-x64.microsoft.private.corefx.netcoreapp
rmdir /S /Q artifacts\packages
build
```
Äîïîëíèòåëüíóþ èíôîðìàöèþ ìîæíî ïîëó÷èòü òóò:
- https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md
- https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md
- https://github.com/dotnet/corefx/blob/master/Documentation/building/windows-instructions.md