In the process of refactoring some code, I encountered several build errors such as these:
Library project file cannot specify ApplicationDefinition element.
2 years later and I came searching with the same question, but was only able to use the above comments to rule out other options and eventually find my answer when I noticed the two projects each had the same identically-named .xaml file within a single solution.
1 solution which has 2 projects: PRINTNOTESPROJ and MAKENOTESPROJ.
During development, I used a XAML window in MAKENOTESPROJ which should actually be part of PRINTNOTESPROJ in the Release executables.
Upon switching to Build->Release, I simply clicked-down on "PrintWindow.XAML" (in MAKENOTESPROJ & with child PrintWindow.xaml.cs) and DRAGGED it onto my PRINTNOTESPROJ.
*This is the key. I forgot that doing this only COPIES the related files to the new project [at least in VS 2010]. From this point onward I received your error until I DELETED "PrintWindow.xaml" from my original project MAKENOTESPROJ.
I hope this makes sense... Please comment with questions!