I'm getting the error:
Error 1 The type 'System.Windows.Markup.IQueryAmbient' is defined in
an assembly that is not referenced. You must add a reference to
assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
When doing the following:
public void ExitApplication()
{
Application.Current.Shutdown();
}
The project is targeted to .NET 4.0, my Visual Studio is 2010, I tried adding
using System.Windows.Markup; with no succes, and
using System.Xaml; where Xaml doesn't exist in namespace System.
What should I do to fix this?
Well ok, I guess your issue is solved when you add System.Xaml.dll as reference to your project. The interface is declared there. Here is the doc.
Add System.Xaml.dll to project references.
You need to add a reference to System.Xaml in your main application project. Using System.Xaml is not needed to be in your code.
Related
Good morning
I encountered a strange error, I google it but no solution worked for me.
What I did: I create 2 projects: Console App, and class Library.
In the class Lib I installed Newtonsoft.Json and I defined some classes.
In the console App I add the reference of the class Library and I call one of the classes that I defined in the CL but I got this error
Error CS0012 The type 'Task<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
I tried to disable the Newtonsoft.Json package but does not seem the problem. I define some Task method in Console App and seem to be working.
So What I think is the same Package "System. threading" is installed in the two projects but I use the same so it does not seem a problem of computability.
After creating a new WPF project in VS 2017 targeting .NET 4.6 as soon as I try to use ObservableCollection<T> in my code I get the following error which prevents the app from building:
ObservableCollection exists in both 'System.Windows' and 'System'
In my projects I created in VS 2015 I have referenced both of these assemblies and the application worked just fine. I tried deleting contents of app's bin and obj folder, restarting VS and performing Build > Clean Solution but that did not help.
Removing reference to System.Windows allows application to build but that adversely affects other code (for example RaiseCanExecuteChanged of my DelegateCommand requires a reference to System.Windows).
Any idea why this is happening and how to fix it?
UPDATE Here is the full error message:
Severity Code Description Project File Line Suppression State
Error CS0433 The type 'ObservableCollection' exists in both
'System.Windows, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' and 'System,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
The problem was that ReSharper was adding a reference to:
C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Windows.dll
instead of:
C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.6.2\System.Windows.dll
Once I removed the reference added by ReSharper and manually added the correct reference the problem was resolved.
ReSharper was detecting that DelegateCommand implementation of ICommand used by my MVVM framework needed a reference to System.Windows but was erroneusly adding a reference to System.Windows found in the NETPortable instead of System.Windows found in .NET...
After I updated my Xamarin Studio (iOS) it gives me this error when trying to build/debug.
I ain't got no clue how to fix this, would appreciate some help
Error:
The type 'MonoTouch.UIKit.UIView' is defined in an assembly that is not referenced.
Consider adding a reference to assembly 'monotouch, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null'
I am using "AlexTouch.MBProgressHUD.dll" and I have added it to my usings.
The public key token of monotouch.dll changed in Xamarin.iOS 6.2 (it's not null anymore).
You'll need to recompile bindings (or assemblies) that refers to monotouch.dll or use the tool (from this thread) to update them.
I have a console Application and I need to occasionally launch a WPF form depending on the parameters. I and trying the following:
if (arg == "/C")
{
System.Windows.Application application = new System.Windows.Application();
application.Run(new EJConfig.MainWindow());
}
The problem is that when I go to add a reference to System.Windows, it doesn't show up in the list of .NET components, and without it I get the following error:
The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
Have you tried adding:
using System.Windows;
To the top of the c# file? You may also need these assemblies:
Assembly: PresentationFramework (in PresentationFramework.dll)
Assembly: PresentationCore (in PresentationCore.dll
Check it out here
you need to add the PresentationFramework and PresentationCore assemblies to your project.
The System.Windows.Application class is located in the PresentationFramework assembly, but you'll also need PresentationCore for it to work.
source:
http://msdn.microsoft.com/en-us/library/system.windows.application.aspx
You are probably missing additional references besides System.Windows. I don't know which are required. You could find out by creating a default application and check the references listed.
So, when I drag in Scintilla to my C# form, and try to run it, I get the error:
The type or namespace name
'ScintillaNet' could not be found (are
you missing a using directive or an
assembly reference?)
The error appears to be coming from the designer for Form1.
I also get the warning (but not error):
The referenced assembly "ScintillaNet"
could not be resolved because it has a
dependency on "System.Design,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which
is not in the currently targeted
framework
".NETFramework,Version=v4.0,Profile=Client".
Please remove references to assemblies
not in the targeted framework or
consider retargeting your project.
So, I can't run my program...
What's wrong, and how do I fix it? I've installed scintilla just like how the directions for it suggested...
I was also experiencing this error (although I am hosting in WPF not WinForms). It was caused by Visual Studio 2010 defaulting the project to .Net 4.0 Client profile rather than the full .Net 4.0 profile.