[英]Blazor namespace Interop does not extist in the namespace
Where do I find the assembly reference and how can I add it?在哪里可以找到程序集引用以及如何添加它?
Error Description:错误说明:
CS0234 The type or namespace name 'Interop' does not exist in the namespace 'Microsoft.AspNetCore.Blazor.Browser' (are you missing an assembly reference?)
CS0234 命名空间“Microsoft.AspNetCore.Blazor.Browser”中不存在类型或命名空间名称“Interop”(您是否缺少程序集引用?)
CS0103 The name 'RegisteredFunction' does not exist in the current context Phoneword.Client
CS0103 当前上下文 Phoneword.Client 中不存在名称“RegisteredFunction”
I have a small Blazor project which I would like to run again after some time.我有一个小的 Blazor 项目,我想在一段时间后再次运行。 But it seems I've deleteted the reference or something else is broken.
但似乎我已经删除了参考或其他东西坏了。
Edit I:编辑我:
Blazor: 0.5.1西装外套:0.5.1
Target framework: .NET Standart 2.0目标框架:.NET Standard 2.0
'RegisteredFunction' does not exist anymore. 'RegisteredFunction' 不再存在。
This is how you define a function in a JavaScript file:这是在 JavaScript 文件中定义函数的方式:
window.exampleJsFunctions = {
showPrompt: function (message) {
return prompt(message, 'Type anything here');
}
};
And this is how you call the function from your Blazor code:这就是您从 Blazor 代码调用该函数的方式:
using Microsoft.JSInterop;
public class ExampleJsInterop
{
public static Task<string> Prompt(string message)
{
// Implemented in exampleJsInterop.js
return JSRuntime.InvokeAsync<string>(
"exampleJsFunctions.showPrompt",
message);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.