[UWP]如何更改App.xaml的位置 [英] [UWP] How to change location of App.xaml

查看:65
本文介绍了[UWP]如何更改App.xaml的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在使用C ++编写UWP编程。


我使用New Project创建了样本 - > Visual C ++ - > Windows - >通用 - >空白应用程序(通用窗口)。这个示例可以无错误地编译并正确运行。


问题是,我想将所有源文件(xaml,cpp,h)移动到名为"src"的子文件夹中。管理。



它看起来像这样:


根项目目录


| - 资产


| - src


|          | - App.xaml


|          | - App.xaml.cpp


|          | - App.xaml.h


|          | - (其余文件)


| - Sample.sln


| - Sample.vcxproj


| - Package.appxmanifest


在vcxproj中移动这些文件并更改与它们相关的所有路径后,我无法编译项目。 


我得到的错误是"  XamlCompiler错误WMC1008:应用程序主文件必须命名为App.xaml"。


这是vcxproj文件中的新ApplicationDefinition字段


    < ApplicationDefinition Include =" src\App.xaml">

  &NBSP; &NBSP; <子类型GT;设计器和LT; /子类型>&NBSP; &NBSP;   

  &NBSP; < / ApplicationDefinition>

  &NBSP; < Page Include =" src\MainPage.xaml">

  &NBSP; &NBSP; < SubType> Designer< / SubType>

  &NBSP; < / Page>


我很确定我们可以更改App.xaml的位置,因为$ b $上的官方样本b https://github.com/Microsoft/Windows-universal-samples 可以做到,但我不知道他们是怎么做的。 


你能帮我解决这个问题:)


投注问候,

解决方案

您好&NBSP;&NBSP; Kien Tran Trung,


当我们使用Visual Studio创建UWP C ++项目时。我们通常尝试以下步骤来调整项目文件结构。构建项目时没有错误。我建议你再试一次。


1:用Visual Studio打开项目


2:右键单击你的项目>>选择添加项 >>选择新的过滤项目。


3:将文件(App.xaml)拖放到Filter(src)中


最好的问候,


Yong Lu


Hello,

I'm leaning programming on UWP with C++.

I created sample by using New Project -> Visual C++ -> Windows -> Universal -> Blank App (Universal windows). This sample can be compiled without error and run correctly.

The problem is, I want to move all source files (xaml, cpp, h) into a subfolder named "src" for managing.

It looks like this:

root project directory

| -- Assets

| -- src

|         | -- App.xaml

|         | -- App.xaml.cpp

|         | -- App.xaml.h

|         | -- (the rest files)

| -- Sample.sln

| -- Sample.vcxproj

| -- Package.appxmanifest

After moving those files and changing all paths related to them in vcxproj , I couldn't compile the project. 

The error I got is " XamlCompiler error WMC1008: Application main file must be named App.xaml".

This is new ApplicationDefinition field in the vcxproj file

   <ApplicationDefinition Include="src\App.xaml">
      <SubType>Designer</SubType>      
    </ApplicationDefinition>
    <Page Include="src\MainPage.xaml">
      <SubType>Designer</SubType>
    </Page>

I'm pretty sure that we can change the location of App.xaml because the offical samples on https://github.com/Microsoft/Windows-universal-samples can do it, but I don't know how they did. 

Could you please help me solve this problem :)

Bets regards,

解决方案

Hi   Kien Tran Trung,

When we create a UWP C++ Project with Visual Studio. We usually try the following steps to adjust the project file structure. There is no error when we build the project. I suggest you try it again.

1: Open the project with the Visual Studio

2: Right click your project >> select the add item >> select new Filter item.

3: Drag and drop your files(App.xaml) into the Filter(src)

Best Regards,

Yong Lu


这篇关于[UWP]如何更改App.xaml的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆