最近我注意到.config
Visual Studio 创建了一个目录,其中有一个dotnet-tools.json
文件。这应该是.gitignore
d 还是签入源代码管理?
我有一个Github Action,它创建了一个dotnet 工具,并尝试使用它。
$ dotnet pack MyTool.csproj --configuration Release
$ dotnet tool install --global --add-source . MyTool
Since you just installed the .NET Core SDK, you will need to logout or restart your session before running the tool you installed.
You can invoke the tool using the following command: my-tool
Tool 'MyTool' (version '1.0.0') was successfully installed.
$ my-tool
my-tool: command not found
Run Code Online (Sandbox Code Playgroud)
我怎样才能logout or restart my session
在工作中,重新加载PATH
?
希望进行以下设置:
我正在开发 Blazor 应用程序,并使用官方的 css 隔离捆绑器。不过,我使用的是Less,并安装了 Less 转换器,它在构建时创建所需的 css。
然而,通过运行我的应用程序dotnet watch run
,它现在通常会陷入无限循环。
其原因可能是dotnet watch run
看到文件发生更改*.razor.css
、重建,并且循环不断重复。
所以这是我的问题:
如何配置我的 csproj(新的网络标准格式)以**\*.razor.css
从监视过程中排除?如果它从我的 VS 解决方案整体中消失也没关系。
无法使用“dotnet”命令行工具构建 .Net .sqlproj。这是错误:
dotnet\sdk\3.1.300\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found
Run Code Online (Sandbox Code Playgroud)
我已经安装了 SSDT 工具,但它在上述位置不可用。
注意:它是使用 Visual Studio 和 MSBuild 没有任何错误的建筑物
.net asp.net-mvc sql-server-data-tools azure-devops dotnet-tool
我使用以下命令通过 Dockerfile 在全局安装 dotnet 工具:
RUN dotnet tool install --global Amazon.Lambda.Tools --version 3.3.0
ENV PATH="$PATH:/root/.dotnet/tools"
Run Code Online (Sandbox Code Playgroud)
我有另一个工具(aws sam),它尝试在内部卸载/重新安装全局工具,以确保安装最新的工具。但它得到以下错误:
Failed to uninstall tool package Invalid cross-device link
Run Code Online (Sandbox Code Playgroud)
当我尝试手动卸载它时,我也遇到同样的错误。
顺便说一句,当我尝试这样做时,这些工具解决得很好:
dotnet lambda --help
Run Code Online (Sandbox Code Playgroud) 我正在尝试执行该dotnet swagger
命令,但收到一条错误消息:
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET Core program, but dotnet-swagger does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Run Code Online (Sandbox Code Playgroud)
我做错了什么以及如何解决它?
我安装了太多 dotnet 工具,但如何将它们保留在最新版本中。我不想更新他们的手册。
\n\n我找到了 github issus:添加dotnet tool update --all
选项 \xc2\xb7 Issue #10130 \xc2\xb7 dotnet/sdk
我在发布配置文件中遇到 Visual Studio 和 EF 迁移的非常奇怪的情况。鉴于:
我已经在本地项目中创建了迁移,当尝试在发布配置文件中枚举迁移时,我得到
Run dotnet tool restore to make the dotnet-ef command available
Run Code Online (Sandbox Code Playgroud)
我不知道这个错误意味着什么,因为似乎安装了 dotnet-ef 工具:
PM> dotnet --version
3.1.101
PM> dotnet ef --version
Entity Framework Core .NET Command-line Tools
3.1.1
PM> dotnet ef dbcontext list --json --project MyUIProject
Build started...
Build succeeded.
[
{
"fullName": "MyDataProject.MyDbContext",
"safeName": "MyDbContext",
"name": "MyDbContext",
"assemblyQualifiedName": "MyDataProject.MyDbContext, MyDataProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
}
]
PM> dotnet tool restore
Restore …
Run Code Online (Sandbox Code Playgroud) entity-framework .net-core asp.net-core dotnet-tool entity-framework-migrations
我们使用正常方式dotnet-tools.json
为我们的项目设置 dotnet 本地工具,但想知道是否有一种方法可以使用通配符版本作为版本号,就像您在 csprojs 中使用包引用所做的那样?
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-rc.1.*" />
Run Code Online (Sandbox Code Playgroud)
我尝试将其更改dotnet-tools.json
为以下内容:
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "5.0.0-rc.1.*",
"commands": [
"dotnet-ef"
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是运行却dotnet tool restore
出现以下错误
Invalid manifest file. Path C:\dev\x\x.api\.config\dotnet-tools.json:
In package dotnet-ef:
Version 5.0.0-rc.1.* is invalid.
Run Code Online (Sandbox Code Playgroud) 我使用 Amazon 模板使用 C# DotNet3.1 创建了一个 AWS Lambda 解决方案
dotnet new serverless.AspNetCoreWebAPI -n MyDotNet.Lambda.Service
Run Code Online (Sandbox Code Playgroud)
这将创建一个 lambda 函数,其处理程序是MyDotNet.Lambda.Service::MyDotNet.Lambda.Service.LambdaEntryPoint::FunctionHandlerAsync
加上一些serverless.template
文件和aws-lambda-tools-defaults.json
部署它的标准方法是安装 Amazon.Lambda.Tools
dotnet tool update -g Amazon.Lambda.Tools
Run Code Online (Sandbox Code Playgroud)
然后运行
dotnet lambda deploy-serverless --profile myawsprofile
Run Code Online (Sandbox Code Playgroud)
请注意,配置文件是可选的,但我已经在该配置文件下配置了 AWS。这将提示输入 CloudFormation 堆栈名称(例如:foo)和一个 S3 存储桶(例如:my-bucket),并将其部署到自定义配置文件下配置的“真实”AWSmyawsprofile
到目前为止一切都很好。现在我刚刚发现https://github.com/localstack/localstack这是在本地运行 AWS 平台的好方法,所以我使用 docker-compose 文件localstack-compose.yml
来启动容器
version: '3.8'
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}"
image: localstack/localstack-full
network_mode: bridge
ports:
- "4566:4566"
- "4571:4571"
- "${PORT_WEB_UI-8080}:${PORT_WEB_UI-8080}" …
Run Code Online (Sandbox Code Playgroud) dotnet-tool ×10
.net ×4
.net-core ×4
asp.net-core ×2
asp.net-mvc ×1
aws-cli ×1
aws-lambda ×1
azure-devops ×1
c# ×1
csproj ×1
docker ×1
entity-framework-migrations ×1
localstack ×1
msbuild ×1
swagger ×1
swashbuckle ×1
ubuntu ×1