简体   繁体   English

Xamarin启动

[英]Xamarin Start-up

I am a newbie in Xamarin. 我是Xamarin的新手。 I created a C# cross-platform project, after the project has been created there were several errors I don't know why these errors occurred. 我创建了一个C#跨平台项目,在创建项目后,出现了多个错误,我不知道为什么会发生这些错误。 How can I fix these errors? 如何解决这些错误? When I click build nothing displays. 当我单击生成时,将不显示任何内容。 When I click Play my default app does not display. 当我单击播放时,我的默认应用程序不会显示。

错误清单

App.xaml 应用程式

<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="App1.App">
    <Application.Resources>

    </Application.Resources>
</Application>

MainPage.xaml MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:App1"
             x:Class="App1.MainPage">

    <StackLayout>
        <!-- Place new controls here -->
        <Label Text="Welcome to Xamarin.Forms!" 
           HorizontalOptions="Center"
           VerticalOptions="CenterAndExpand" />
    </StackLayout>

</ContentPage>

MainPage.xaml.cs MainPage.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

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

Try to reinstall the Xamarin with Visual studio , It seems there has been something missing form installation. 尝试使用Visual Studio重新安装Xamarin,似乎安装了某些缺少的东西。 You can find the documentation here 您可以在这里找到文档

https://docs.microsoft.com/en-us/xamarin/cross-platform/get-started/installation/windows https://docs.microsoft.com/zh-cn/xamarin/cross-platform/get-started/installation/windows

Regards 问候

  • Right click on your project 右键点击您的项目
  • Manage Nuuget Packages 管理Nuuget软件包
  • Installed tab : Check if Xamarin is intalled, if yes update it, if not install xamarin 已安装标签:检查Xamarin是否已安装,如果是,则更新它,如果未安装,则更新xamarin
  • Clean and rebuild your project. 清理并重建您的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM