我正在尝试在我的部署目标计算机上安装 playwright 以便运行 UI 测试。
# Install the CLI once.
dotnet tool install --global Microsoft.Playwright.CLI
playwright install
Run Code Online (Sandbox Code Playgroud)
然而,当使用 playwright CLI 包括 playwright 安装时,我得到:
找不到使用 Playwright 的项目。确保项目或解决方案存在于 C:\users\myuser 中,或使用 -p 提供另一个路径。
如何在虚拟机上安装 playwright?
编辑:
不幸的是,剧作家的 .NET nuget 包设计得不是很好。虽然 API 很棒,但部署却是一场噩梦。
您不仅无法在部署服务器上使用 CLI 安装浏览器,而且该软件包还向您的项目以及引用它的所有项目添加了 3x NodeJS 运行时 (200MB)。
阻止这些文件被发布是很重要的,并且每个构建的构建工件可以轻松增长到 1GB!
您无法配置 NodeJS 或剧作家本身的路径。
您可以在这里投票修复此问题: https ://github.com/microsoft/playwright-dotnet/issues/1850
我正在尝试通过 dotnet-cli 安装 dotnet-ef 工具。
我输入的命令:dotnet tool install --global dotnet-ef
它给了我以下错误:
C:\Users\%USERNAME%\AppData\Local\Temp\147383a8-b714-4336-bb96-30c0670ea37d\restore.csproj : error NU1211: Project res
tore must have a single package reference(s).
C:\Users\abby.rahimi\AppData\Local\Temp\147383a8-b714-4336-bb96-30c0670ea37d\restore.csproj : error NU1212: Invalid pro
ject-package combination for Microsoft.DotNet.Analyzers.Compatibility 0.2.12-alpha. DotnetToolReference project style c
an only contain references of the DotnetTool type
The tool package could not be restored.
Tool 'dotnet-ef' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the …
Run Code Online (Sandbox Code Playgroud) 我正在使用 dotnet-tool 和 nuget;我注意到,如果我将刷新 nameOfPackage.nupkg 推送到 nuget 存储库,然后运行dotnet tool update -g nameOfPackage
它,则不会采用新的软件包版本。
我必须强制清除缓存才能使其获取最新的缓存。
dotnet nuget locals http-cache -c
Run Code Online (Sandbox Code Playgroud)
我之前安装了该软件包
dotnet tool update -g nameOfPackage
Run Code Online (Sandbox Code Playgroud)
这是设计使然吗?我是否必须每次都刷新缓存以确保该工具没有更新?
我正在尝试使用 EntityFrameworkCore@3.1。为了做到这一点,我已经有了: - 安装了 Visual Studio 2019 预览版 - 安装了 .NET Core 3.1 运行时 - 安装了 .NET Core 3.1 SDK
现在我仍然无法运行命令dotnet ef migrations add xxx
。据说我必须更新 dotnet 工具。所以我在管理员 powershell 中运行以下命令:
PS C:\WINDOWS\system32> dotnet tool update --global dotnet-ef
Tool 'dotnet-ef' was reinstalled with the latest stable version (version '3.0.0')
Run Code Online (Sandbox Code Playgroud)
好的,不包括预览版本。所以我尝试明确指定版本:
PS C:\WINDOWS\system32> dotnet tool update --global dotnet-ef --version="3.1.0-preview1.19506.2"
error NU1202: Package dotnet-ef 3.1.0-preview1.19506.2 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any. Package dotnet-ef 3.1.0-preview1.19506.2 supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1)
Tool 'dotnet-ef' failed …
Run Code Online (Sandbox Code Playgroud) 在 Azure Devop Build 中,我使用一个工具(https://github.com/tomchavakis/nuget-license)。我希望将此工具安装在我的 Azure Devop Agent 中。
我在 YML 中创建了此任务:
- task: CmdLine@2
displayName: 'Install dotnet-project-licenses'
inputs:
script: 'dotnet tool install dotnet-project-licenses -g'
Run Code Online (Sandbox Code Playgroud)
这有效,但只是第一次。然后,当该工具已安装时,我收到错误代码。
那么如何在我的代理上自动安装一次呢?还是吞掉错误?
当您想要更新或安装 dotnet 工具时,您需要显式提供预览版本。它在我们的 DevOps 环境中不起作用,因为我们需要始终使包保持最新(包括预览版本)。没有像--preview
更新/安装最新版本(包括预览版本)这样的参数。如何将 dotnet 工具更新到最新版本(包括预览版本)?
dotnet-tool ×6
.net-core ×2
c# ×2
.net ×1
.net-6.0 ×1
azure ×1
azure-devops ×1
nuget ×1
playwright ×1
powershell ×1
preview ×1