Problem: After including some XAML files from a Visio document in a Visual Studio solution you’re unable to build the solution and receive the error:
Project file must include the .NET Framework assembly ‘WindowsBase, PresentationCore, PresentationFramework’ in the reference list
Cause: When you include XAML files in a solution it assumes you want to compile the XAML resources and subsequently throws the above exception because it can’t find the required WPF assemblies.
In this case, I was only wanting the add the files as content to the solution to keep them under source control.
Solution: To solve this, firstly, unload the project from the solution by right clicking the project and choosing unload project. This can be seen in figure 1.
Then, right click the project and choose edit project. This will open the XML for the project file. Now, find the XAML entries.
- <Content Include="Processes\Flowcharts\Change\xaml_2.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Content>
Change this to read.
- <Content Include="Processes\Flowcharts\Change\xaml_2.xaml"/>
The project should now build.
