简体   繁体   English

Blazor 命名空间互操作在命名空间中不存在

[英]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.

相关问题 Blazor应用程序Asp.Net Core 2.1中的命名空间中不存在使用INTEROP的错误 - Error in using INTEROP does not exist in the namespace in Blazor application Asp.Net Core 2.1 Blazor说类型或名称空间名称在名称空间“ __Blazor…”中不存在 - Blazor says type or namespace name does not exist in the namespace '__Blazor…' 命名空间“ Interop”在命名空间“ Microsoft.Office”中不存在 - Namespace 'Interop' does not exist in namespace “Microsoft.Office” @namespace 指令在 Blazor 中不起作用 - the @namespace directive is not working in Blazor C#类型或名称空间名称“ Interop”在名称空间“ Microsoft.Office”中不存在(您是否缺少程序集引用?) - C# The type or namespace name 'Interop' does not exist in the namespace 'Microsoft.Office' (are you missing an assembly reference?) 如何使用命名空间与C ++交互 - How to Interop to C++ with Namespace Blazor:命名空间“Microsoft.AspNetCore.Mvc.ApplicationParts”中不存在类型或命名空间名称“ApplicationPartAttributeAttribute” - Blazor: The type or namespace name 'ApplicationPartAttributeAttribute' does not exist in the namespace 'Microsoft.AspNetCore.Mvc.ApplicationParts' Blazor WASM 页面上的命名空间问题 - Namespace issue on Blazor WASM Page Blazor:在 Razor 文件中定义命名空间 - Blazor: Define namespace in Razor File 名称空间错误中不存在名称空间RoleExists - the namespace RoleExists does not exist in the namespace error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM