Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Project file must include the .NET Framework assembly 'WindowsBase, PresentationCore, PresentationFramework' in the reference list

Tags:

winforms

wpf

I am using WPF in a Windows Forms Application with C#.

Follow up of the question. Adding a collection of solid,dashed lines pen to a combo box

Error:

Project file must include the .NET Framework assembly 'WindowsBase, PresentationCore, PresentationFramework' in the reference list.

Please suggest

like image 218
user575219 Avatar asked May 30 '12 16:05

user575219


People also ask

Which Assembly must be included in the project file?

RDLC issue : Project file must include the .NET Framework assembly 'WindowsBase, PresentationCore, PresentationFramework' in the reference list. [Answered]RSS 4 replies Last postMar 24, 2011 06:54 AM by nata44 ‹ Previous Thread|Next Thread › PrintShare Twitter Facebook Email Shortcuts Active Threads Unanswered Threads

How do I resolve the application version error in project designer?

Change the version setting from 4.0.0.0 to 2.0.0.0. If your application has resources such as icons or bitmaps or settings such as data connection strings, you can also resolve the error by removing all the items on the Settings page of the Project Designer and then re-adding the required settings.

Why am I getting MSBuild errors?

This topic describes MSBuild errors that might occur because of reference issues and how you can resolve those errors. You can create applications that reference projects or assemblies that target different versions of the .NET Framework.

Can I create applications that reference different versions of the framework?

You can create applications that reference projects or assemblies that target different versions of the .NET Framework. For example, you can create an application that targets the client profile for the .NET Framework 4 but references an assembly that targets the .NET Framework 2.0.


2 Answers

In Visual Studio, go to Project menu > Add Reference > .NET tab, select WindowsBase, PresentationCore and PresentationFramework in the list and press OK. Then try again.

like image 93
Ross Avatar answered Oct 26 '22 15:10

Ross


It's an old question, but for the purpose of keeping this resource a valid one: it is true that you can add references likes this, as Ross and Reed suggest, but I do not believe that this is the actual solution, you're just fixing the effect of an issue, not the cause.

Exactly like @dumbledad says, I got the exact same error message when I included files in my project that got marked as a 'Page' in the .csproj file, resulting in Visual Studio wanting to compile this resource. However, this being an uncompilable resource (in my case it was a XAML file, could be an image as well) Visual Studio asks for extra assemblies. In this case, do not just add them, but go into your .csproj file and make the following adjustment:

Search for the opening node '<Page' and verify that each instance of it actually is a page that needs to treated with the corresponding action. In my case, as you can see, a resource is marked as a Page, which VS tries to Compile:

<ItemGroup>
  <Page Include="sitecore\shell\ClientBin\EmptySplashScreen.xaml">
    <Generator>MSBuild:Compile</Generator>
  </Page>
</ItemGroup>

Just remove this section (or Page-node) and put the file back into the .csproj file as a regular content include. You have to do this manually, as including the file from within VS regenerates the same faulty Page-node. So I've put it back into the project file like this:

<Content Include="sitecore\shell\ClientBin\EmptySplashScreen.xaml" />

Et voila, your project will build again and the error message disappears without having to add those extra assembly references.

like image 42
Rob Habraken Avatar answered Oct 26 '22 13:10

Rob Habraken