From c7eb991e262ce43a6e67482c044fd85fa56d54ae Mon Sep 17 00:00:00 2001 From: bicijinlian Date: Sun, 26 May 2024 23:47:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + Docs/1.6.测试.ipynb | 163 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 Docs/1.6.测试.ipynb diff --git a/.gitignore b/.gitignore index 59f49b7..e22c0f2 100644 --- a/.gitignore +++ b/.gitignore @@ -459,3 +459,6 @@ FodyWeavers.xsd # Rider .idea/ +# publish +Docs/Publish/ + diff --git a/Docs/1.6.测试.ipynb b/Docs/1.6.测试.ipynb new file mode 100644 index 0000000..48ee014 --- /dev/null +++ b/Docs/1.6.测试.ipynb @@ -0,0 +1,163 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, + "source": [ + "# HttpClient 测试" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "source": [ + "## 1、引用项目Dll" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [], + "source": [ + "//引用项目\n", + "#r \"./Publish/HttpClientStudy.Core/HttpClientStudy.Core.dll\"\n", + "\n", + "using HttpClientStudy.Core.Utilities;\n", + "var result = CmdUtility.RunCmd(\"ls\");\n", + "Console.WriteLine(result);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 启动项目" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "dotnet_interactive": { + "language": "pwsh" + }, + "polyglot_notebook": { + "kernelName": "pwsh" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [ + { + "ename": "Error", + "evalue": "Command failed: SubmitCode: #启动项目 ...", + "output_type": "error", + "traceback": [ + "Command failed: SubmitCode: #启动项目 ..." + ] + } + ], + "source": [ + "#启动项目\n", + "Start-Process -FilePath \".\\Publish\\HttpClientStudy.WebApp\\HttpClientStudy.WebApp.exe\"" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "dotnet_interactive": { + "language": "pwsh" + }, + "polyglot_notebook": { + "kernelName": "pwsh" + }, + "vscode": { + "languageId": "polyglot-notebook" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[31;1mGet-Process: \u001b[0m\n", + "\u001b[31;1m\u001b[36;1mLine |\u001b[0m\n", + "\u001b[31;1m\u001b[36;1m\u001b[36;1m 3 | \u001b[0m $WebAppProc = \u001b[36;1mGet-Process $WebAppProcName\u001b[0m\n", + "\u001b[31;1m\u001b[36;1m\u001b[36;1m\u001b[0m\u001b[36;1m\u001b[0m\u001b[36;1m | \u001b[31;1m ~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[0m\n", + "\u001b[31;1m\u001b[36;1m\u001b[36;1m\u001b[0m\u001b[36;1m\u001b[0m\u001b[36;1m\u001b[31;1m\u001b[31;1m\u001b[36;1m | \u001b[31;1mCannot find a process with the name \"HttpClientStudy.WebApp\". Verify the process name and call the cmdlet again.\u001b[0m\n" + ] + }, + { + "ename": "Error", + "evalue": "Command failed: SubmitCode: # 关闭项目进程 ...", + "output_type": "error", + "traceback": [ + "Command failed: SubmitCode: # 关闭项目进程 ..." + ] + } + ], + "source": [ + "# 关闭项目进程\n", + "$WebAppProcName =\"HttpClientStudy.WebApp\";\n", + "$WebAppProc = Get-Process $WebAppProcName\n", + "if($WebAppProc -ne $null)\n", + "{\n", + " Stop-Process $WebAppProc.Id\n", + "}" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".NET (C#)", + "language": "C#", + "name": ".net-csharp" + }, + "language_info": { + "name": "python" + }, + "polyglot_notebook": { + "kernelInfo": { + "defaultKernelName": "csharp", + "items": [ + { + "aliases": [], + "name": "csharp" + } + ] + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}