Neues .NET MAUI -App -Projekt wirft "den Namen" InitializeComponent "aus, die im aktuellen Kontext nicht vorhanden sind.C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Neues .NET MAUI -App -Projekt wirft "den Namen" InitializeComponent "aus, die im aktuellen Kontext nicht vorhanden sind.

Post by Anonymous »

Ich habe versucht, mit .NET MAUI zu spielen und meine Entwicklungsumgebung eingerichtet, die in den Schritten folgen, wie in:
  • https: // lern.microsoft.com/en-us/dotnet/maui/get-started/first-app?pivots=windows
  • https://learn.microsoft.com/en-us/s/ Windows/Apps/Project-Reunion/Setup-your-Development-Environment#forders-Workload--and-components
  • https://learn.microsoft.com/en-us/ Xamarin/Android/Get-Started/Installation/Android-Emulator/Geräte-Manager? Tabs = Windows & Pivots = Windows
Ich habe auch die 'Maui ausgeführt -Con 'CLI Tool und alles prüft, aber wenn ich eine neue .NET MAUI -App mit Visual Studio 2019 V16.11.0 Preview 2.0 (ausgeführt unter Windows 10 Home 20H2) erstelle Im aktuellen Kontext "Erstellen Sie Fehler. Es findet auch nicht die Verweise auf Kontrollen auf der Form, z. 'Der Name' Gegenlabel 'existiert nicht im aktuellen Kontext. Hinzufügen und Entfernen von Dateien, Änderungen vornehmen und sie zurückziehen Was ich zeige, dass die Namespaces korrekt sind: < /p>
app.xaml:

Code: Select all

...

< /code>
app.xaml.cs
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;
using System;
using Application = Microsoft.Maui.Controls.Application;

namespace MauiApp1
{
public partial class App : Application
{
public App()
{
InitializeComponent(); 
MainPage.xaml:
ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp1.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">

...

< /code>
MainPage.xaml.cs
using System;
using Microsoft.Maui.Controls;

namespace MauiApp1
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post