Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems after copying XAML controls from WPF Application to a class library

Tags:

.net

wpf

xaml

In the process of refactoring some code, I encountered several build errors such as these:

Library project file cannot specify ApplicationDefinition element.

The project file contains a property value that is not valid.

How can these errors be resolved?

like image 580
dmo Avatar asked Jun 26 '09 18:06

dmo


1 Answers

When you copy and paste files either within a project or to another project, Visual Studio has a nasty habit of not keeping the same BuildAction property. It often changes the build action to a seemingly random value, e.g. ApplicationDefinition, which causes that build error.

Check (in the Visual Studio properties window with the file selected in the Solution Explorer) that each of your .xaml files have a BuildAction property of Page and your code files have a BuildAction property of Compile.

like image 157
fubaar Avatar answered Oct 06 '22 03:10

fubaar