我刚刚通过创建了新的 blazor 项目
dotnet new blazorhosted
并打开FetchData.cshtml,但 VS 向我抛出了 9 个错误。
当然,整个项目正在编译并且工作正常,但是很烦人
如何禁用显示.cshtml文件错误?
Visual Studio 2019 预览版
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'forecasts' does not exist in the current context Blazor.Client FetchData.cshtml 27 Active
Error CS0115 'Template.ExecuteAsync()': no suitable method found to override Blazor.Client FetchData.cshtml 1 Active
Error CS0229 Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client FetchData.cshtml 1 Active
Error CS0229 Ambiguity between 'Template.__o' and 'Template.__o' Blazor.Client FetchData.cshtml 1 Active …Run Code Online (Sandbox Code Playgroud) Blazor是否可以使用.NET Core 2.2或3.0?
因为此时此blazorhosted模板将创建一个客户端项目作为.NET Standard,从而阻止使用.NET Core 3.0。
Project blazor.Shared与netstandard2.0(.NETStandard,Version = v2.0)不兼容。项目blazor.Shared支持:netcoreapp3.0(.NETCoreApp,Version = v3.0)blazor.Client C:\ app \ blazor.Client \ blazor.Client.csproj 1
将所有内容更改为.NET Core 3.0之后,出现以下错误:
rzc generate退出,代码为1。
那么,是否有可能,我做错了什么?还是没有办法?
我想制作onclick需要输入的按钮功能.
<button onclick="@test(123, 456)">Check</button>
@functions
{
public void test(int a, int b)
{
Console.WriteLine(a + b);
}
}
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,它会抛出一个错误:
Argument "1": Cannot convert from void to string
后来我想在for循环中创建那些按钮
@for (int i = 0; i < 10; i++)
{
<button onclick="@test(i, 5 * i)">Check</button>
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我有一个在 Windows 2019 Server 实例上运行的在屏幕上执行单击的应用程序
但问题是,当我关闭 RDP 时,应用程序将停止工作(单击)
我怀疑这是由于我关闭 RDP(使用“X”按钮)时用户注销造成的。
当我关闭 RDP 时,有什么方法可以“不丢失屏幕”吗?
我正在动态生成 N 列 x M 行的表
\n我正在尝试使其尽可能使用默认打印选项进行打印
\n所以,
\n每当我们在A1/A2/A3/A4纸上打印表格时,表格应该尽量占据一张纸的可用空间,字体尽可能大(会看的人视力可能不太好) )
\n但是当我使用 Microsoft Edge 时(它有控制缩放、边距等的工具,这就是我使用它的原因,这也让我担心,Chrome/FF/Edge 上的打印结果可能会有所不同)
\n并使用预览 (CTRL+P),那么它总是要么占用一页以上,要么仅使用 40% 的可用空间
\nA4纸,无边距:
\nfit to the printing area:
real size:
部分代码:
\n<!DOCTYPE html>\n<html lang="pl-PL">\n<head>\n<title>Plan zaj\xc4\x99\xc4\x87</title>\n\n<style> \n .printable-tables \n {\n white-space: nowrap;\n }\n\n .printable-tables > table \n {\n display: inline-table;\n }\n\n @page \n {\n size: landscape;\n }\n\n .printable-tables > table \n {\n page-break-before: always;\n page-break-after: always;\n }\n\n .header_low_height\n {\n }\n\n …Run Code Online (Sandbox Code Playgroud) 假设我正在使用安装了 Blazor 模板的 Core 3.0
我的 VS 更新并下载了 sdk ,现在我的 dotnet cli默认3.1 preview X可以工作3.1 preview
因此 usingdotnet new不会显示我在使用时安装的已安装 Blazor 模板3.0
我尝试了这些命令至少查看以前模板的名称或实际创建3.0Blazor 项目,但没有任何效果
dotnet new --sdk-version "3.0.100-preview7-012821"
dotnet new --framework "netcoreapp3.0"
# Invalid input switch:--sdk-version3.0.100-preview7-012821
Run Code Online (Sandbox Code Playgroud)
如何列出dotnet new以前的 sdk/框架的模板,然后实际创建它们?
我在 BenchmarkDotNet 上遇到问题,很难解决
这是我的项目结构:
-
| - Infrastructure
| |
| | - TestsBenchmark
| | - MyInfra.sln
| - src
| - Tests
| - MyProduct.sln
Run Code Online (Sandbox Code Playgroud)
TestsBenchmark引用Tests并且只有这行代码:
BenchmarkSwitcher.FromAssembly(typeof(BasicTests).Assembly).RunAll();
Run Code Online (Sandbox Code Playgroud)
但是当我通过它运行dotnet run -c Release它时它会抛出
// Generate Exception: Unable to find Tests in ...\Infrastructure and its subfolders. Most probably the name of output exe is different than the name of the .(c/f)sproj
以前我的项目结构是这样的:
-
| - src
| - Tests
| - TestsBenchmark
Run Code Online (Sandbox Code Playgroud)
一切正常
复制步骤(手动),它重新创建文件夹结构、项目、项目关系、解决方案并添加 nuget。在某个空文件夹中的例如 powershell …
我想要达到的目标:
我想在外部程序执行 console_app.exe 时在 Discord 频道上发送消息,所以我决定使用纯休息:
我通过 https://discord.com/developers/applications
我有 ClientId 和 ClientSecret,现在我想从代码登录并在特定频道上发送消息
我正在获取令牌而没有响应问题,例如:
{
"access_token": "6qrZcUqja781...HBFG",
"token_type": "Bearer",
"expires_in": 604800,
"scope": "identify connections"
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试发送消息(函数WriteMessage)时,我Unauthorized出于某种原因
整个代码:
private static readonly RestClient client = new RestClient("https://discord.com");
public string Perform()
{
client.Authenticator = new HttpBasicAuthenticator(_config.ClientId, _config.ClientSecret);
var token = GetToken();
client.Authenticator = null;
return WriteMessage(token);
}
Run Code Online (Sandbox Code Playgroud)
private string GetToken()
{
var signInRequest = new RestRequest("/api/v6/oauth2/token", Method.POST);
signInRequest.AddHeader("content-type", "application/x-www-form-urlencoded");
signInRequest.AddParameter("grant_type", "client_credentials");
signInRequest.AddParameter("scope", "identify connections");
var result = client.Execute<AuthResult>(signInRequest);
return result.Data.access_token; …Run Code Online (Sandbox Code Playgroud)