我遵循了此页面中的说明:
https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-8/
我的PC系统:Windows 10 Pro /版本1803 /操作系统内部版本:17134.950
1)已将VS2019预览版更新为16.3.0预览版2.0
2)通过此链接安装SDK和运行时:
https://dotnet.microsoft.com/download/dotnet-core/3.0#runtime-3.0.0-preview8
2a)SDK 3.0.100-preview8-013656
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.config import Config
from kivy.lang import Builder
from kivy.uix.behaviors import DragBehavior
from kivy.uix.relativelayout import RelativeLayout
Config.set('input', 'mouse', 'mouse,disable_multitouch')
Builder.load_string(f'''
<Node@RelativeLayout>:
drag_rectangle: self.x, self.y, self.width, self.height
drag_timeout: 10000000
drag_distance: 10
canvas.before:
Color:
rgba: self.bcolor
RoundedRectangle:
pos: 0, 0
size: self.size
radius: [10,]
''')
class Node(DragBehavior, RelativeLayout):
def __init__(self, **kwargs):
self.bcolor = (0, 0, 1, 1)
super(Node, self).__init__(size=(100, 100), **kwargs)
def placement_pos(self, x, y):
return (x - self.node_width() / 2, y - self.node_height() / 2)
Builder.load_string(f'''
<GrapherUI@Widget>:
canvas.before:
Color:
rgba: {.5, 1, .5, 1}
Rectangle:
pos: self.pos
size: self.size
''')
class GrapherUI(Widget):
def __init__(self, graph=None, **kwargs):
super(GrapherUI, self).__init__(**kwargs)
def on_touch_down(self, touch):
touched_children = [x for x in self.walk(restrict=True) if x is not self and x.collide_point(*touch.pos)]
has_touched_children = any(touched_children)
if touch.button == 'right':
if not has_touched_children:
self.add_node(touch)
elif touch.button == 'middle':
self.remove_node(touched_children, touch)
super(GrapherUI, self).on_touch_down(touch)
def add_node(self, touch):
print('add node')
with self.canvas:
node = Node(pos=(touch.x, touch.y))
self.add_widget(node)
def remove_node(self, touched_children, touch):
for node in touched_children:
print('remove node')
self.remove_widget(node)
class Main(App):
def build(self):
return GrapherUI()
if __name__ == '__main__':
Main().run()
2b)运行时3.0.0-preview8-28405-07
selected and installed: x64 and x86
Net Core Installer :x64 | x86
3)在以下命令中运行此命令:COMMAND Promt,Power Shell以及在VS2019中使用程序包管理器控制台
新的dotnet -i Microsoft.AspNetCore.Blazor.Templates :: 3.0.0-preview8.19405.7
启动VS2019 Preview并创建Blazor WebAssembly应用
单击要生成的重建,它会在错误消息下方显示:
问题:
CS0234这些页面的名称空间“ Microsoft.AspNetCore.Components”(您是否缺少程序集引用?)中不存在类型或名称空间名称“ LayoutAttributeAttribute”:
Counter.razor.g.cs
FetchData.razor.g.cs
Index.razor.g.cs
_imports.razor.g.cs
请帮助解决该问题。
更新:
1)仅使用x64 Net Core SDK,在创建Blazor项目之后,它将包含用于客户端/共享/服务器的空项目。
2)因此,我安装了另一个x86网络核心SDK。对于X64和X86,这将在选择模板的步骤中显示消息:.NET Core SDK安装在多个位置。仅显示安装在“ C:\ Program Files \ dotnet \ sdk \”中的SDK中的模板。但是,Blazor项目不会为空,但是在执行重建解决方案后会出现与上述相同的问题。 >
3)卸载x64。仅使用x86,它将仍然显示味精: .NET Core SDK安装在多个位置。仅显示安装在“ C:\ Program Files \ dotnet \ sdk \”中的SDK中的模板。但是,Blazor项目不会为空,但是在执行重建解决方案后,会出现与上述相同的问题。
谢谢