【问题标题】:Visual Studio Builds Xaml Files Every Run (Without Any Changes)Visual Studio 每次运行都会生成 Xaml 文件(没有任何更改)
【发布时间】:2018-09-05 04:19:41
【问题描述】:

我在 Visual Studio 2017 中有一个 Xamarin.Forms 解决方案。目前 Android 和 UWP 解决方案已卸载且未使用。有时,Visual Studio 决定在我每次运行项目时构建 Xamarin.iOS 解决方案。我所说的“偶尔”的意思是,一旦它执行一次,每次运行时都很难让它不构建。通常的过程类似于删除 bin/obj 文件夹 --> Clean Solution --> Rebuild Solution。有时这会修复不断的构建,但大多数时候它不会。重新启动 VS 似乎也不起作用。

如果我的解决方案中的任何文件已更改,尝试运行时出现的构建消息如下所示:

1> Project 'myApp.iOS' is not up to date. Missing output file 
'C:\pathToApp\myApp.iOS\bin\iPhone\Debug\myAppiOS.exe'.
1> ------ Build started: Project: myApp.iOS, Configuration: Debug iPhone ------

这是正常的。发生变化时需要重建。

如果 VS 决定每次运行项目时都需要构建应用程序,请记住这是没有进行任何更改的,它看起来像这样:

1> Project 'myApp.iOS' is not up to date. Missing input file 
'c:\pathToApp\myapp.ios\obj\iphone\debug\myapp.ios.c_.dev.users.jtth.xamarin.appfoldername.myapp.app.xaml.g.cs'.
1> ------ Build started: Project: StixApp.iOS, Configuration: Debug iPhone ------

Google 在这个问题上没有太多帮助。 Xaml 文件似乎或至少似乎是一个问题,因为我只看到与 Xaml 相关文件 (xaml/xaml.cs) 的此输出。但是,话虽如此,我不知道为什么会出现这个问题。这是唯一的信息。 VS 在“构建开始”消息之前吐出。

一些额外的信息 -

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="myApp.App">
  <Application.Resources>
        <ResourceDictionary>
            <Color x:Key="Primary">#2196F3</Color>
            <Color x:Key="PrimaryDark">#1976D2</Color>
            <Color x:Key="Accent">#96d1ff</Color>
            <Color x:Key="LightBackgroundColor">#FAFAFA</Color>
            <Color x:Key="DarkBackgroundColor">#C0C0C0</Color>
            <Color x:Key="MediumGrayTextColor">#4d4d4d</Color>
            <Color x:Key="LightTextColor">#999999</Color>

            <Style TargetType="NavigationPage">
                <Setter Property="BarBackgroundColor" Value="{StaticResource Primary}" />
                <Setter Property="BarTextColor" Value="White" />
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>

App.xaml.cs:

using Xamarin.Forms;

namespace myApp
{
    public partial class App : Application
    {
        public static Connection CocoonConnection = new Connection();
        public static Settings AppSettings = new Settings();

        public App()
        {
            InitializeComponent();

            MainPage = new MainPage();
        }
    }
}

myApp.iOS.App.xaml.g(@路径:C:\Users\jtth\Xamarin\appFolderName\myApp\myApp.iOS\obj\iPhone\Debug)

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace myApp {


    [global::Xamarin.Forms.Xaml.XamlFilePathAttribute(
       "C:\\Users\jtth\\Xamarin\\appFolderName\\myApp\\App.xaml")]
    public partial class App : global::Xamarin.Forms.Application {

        [global::System.CodeDom.Compiler.GeneratedCodeAttribute(
            "Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")]
        private void InitializeComponent() {
            global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(App));
        }
    }
}

任何建议将不胜感激。

附:请不要将此标记为与@Chris 的帖子“Visual Studio Builds Projects Every Time I Run”的重复,因为该帖子与我认为的 Xaml 问题无关。谢谢。

【问题讨论】:

    标签: c# xaml xamarin xamarin.forms visual-studio-2017


    【解决方案1】:

    据人们所知,此错误是由 Visual Studio 安装导致的,需要一起修复和/或重新安装。重新安装后未遇到此错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-15
      • 1970-01-01
      • 2015-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多