简体   繁体   中英

How do you get Visual Studio to recognise XAML changes?

I have just started with WPF so am probably missing something simple here. I have a window that I am editing in VS 2010. When I change the XAML by hand and then run the application (F5) the window remains as before my edit, however if I do a rebuild and then run the application my changes show up.

Is there any way to get VS to recognise that I have changed my XAML file and recompile it automatically when I press F5?

It turns out that my UI project was not set to build in the configuration I had selected. Although it was set to build in Debug x86 I had set the current config to Debug Any CPU.

What worked for me in Visual Studio 2012:

  1. Go to Tools -> Options -> Projects and Solutions -> Build and Run
  2. For "On Run, when projects are out of date" select "Always build"
  3. Uncheck "Only build startup projects and dependencies on Run"

You can change a VS setting to save all files before Build/Run. Go to

Tools->Options->Projects and Solutions->Build and Run

Update Before building and On Run, when projects are out of date values to Save all changes and Always build respectively.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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