{ "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": 3, "metadata": { "dotnet_interactive": { "language": "csharp" }, "polyglot_notebook": { "kernelName": "csharp" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\r\n" ] } ], "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": 8, "metadata": { "dotnet_interactive": { "language": "pwsh" }, "polyglot_notebook": { "kernelName": "pwsh" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "#启动项目\n", "Start-Process -FilePath \".\\Publish\\HttpClientStudy.WebApp\\HttpClientStudy.WebApp.exe\"" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "dotnet_interactive": { "language": "pwsh" }, "polyglot_notebook": { "kernelName": "pwsh" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "# 关闭项目进程\n", "$WebAppProcName =\"HttpClientStudy.WebApp\";\n", "$WebAppProc = Get-Process $WebAppProcName\n", "if($WebAppProc -ne $null)\n", "{\n", " Stop-Process $WebAppProc.Id\n", "}" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "dotnet_interactive": { "language": "pwsh" }, "polyglot_notebook": { "kernelName": "pwsh" }, "vscode": { "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ "# 新窗口启动WebApi\n", "Start-Process -FilePath dotnet -ArgumentList \"run --project ..\\HttpClientStudy.WebApp\\HttpClientStudy.WebApp.csproj\"" ] } ], "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 }