I am trying to use the C# library GattCharacteristic and I'm having trouble with references. I used Nuget to get the UwpDesktop package which was a suggestion posted elsewhere.
'Windows.Devices.Bluetooth.GenericAttributeProfile.GattCharacteristic' in assembly 'Windows' causes a cycle.
The type name 'GattCharacteristic' could not be found in the namespace 'Windows.Devices.Bluetooth.GenericAttributeProfile'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly.
I've also tried adding the windows.winmd reference and adding <TargetPlatformVersion>10.0</TargetPlatformVersion> to the .csproj file with no success.
Related
I have an MVC project that makes reference to a custom DLL in another project. The DLL is called "Web" and has the classes that I need in "Models".
I have added the DLL as a reference in the project where it is needed, and in the controllers and the models of the project, it is available. I can use the line:
using Web.Models.Base;
And
using Web.Models.AppToolKit
And all the objects in those classes are available.
However in the views, in that same project, the Web namespace is not available at all. I get:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'Web' could not be found (are you missing a using directive or an assembly reference?)
And when I use the model I created in the project in the view, which inherits from the reference DLL and compiles with no problem, I get the error:
Error CS0012 The type 'BasicNetPageModel' is defined in an assembly that is not referenced. You must add a reference to assembly 'Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Even though that DLL is referenced, and is working in both the models and the controllers for the same project.
I am using VS 2019. I have tried removing/re-adding the reference and cleaning/rebuilding many times.
I have tried adding:
<add namespace="TASWeb.Models.Base"/>
in the web.config.
Any idea?
Looks like the problem was a second DLL, which was referenced from within the first DLL.
The project for that one was set to x86. I set it to ANY CPU, recompiled, then recompiled the first DLL, then the project in question was able to recognize the namespace.
I have a WebAPI project which had an old assembly reference to System.ComponentModel.DataAnnotations.dll
I am trying to add some logging and the nuget package for Microsoft.Extensions.Logginghas a dependency on System.ComponentModel.Annotations.dll which conflicts with the assembly reference.
After removing the assembly reference the project still compiles just fine, but at runtime I get an exception when I reach code with annotations:
Could not load file or assembly 'System.ComponentModel.Annotations,
Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file specified.
I have tried installing the nuget package for System.ComponentModel.Annotations, but I still get the same error.
How do I replace the assembly reference to ComponentModel.DataAnnotations with the nuget package?
I have just downloaded, today, the free startup template for MVC5 and EF.
On opening, restoring all packages then building, I get the following build error in the "Core" project:
Error CS0508 'AppSettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)': return type must be 'IEnumerable' to match overridden member 'SettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)'
Error CS0012 The type 'Object' 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'.
As the error message suggested, I added the reference to the assembly, however, that produced a whole lot of other errors.
Looking at the sample projects, they are using v2.1.3 of the APB assemblies and they compile fine.
The latest downloaded sample uses v3.0.0 of the APB assemblies.
Any help to get this up and running is appreciated. Thanks in advance.
Error CS0508 'AppSettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)': return type must be 'IEnumerable' to match overridden member 'SettingProvider.GetSettingDefinitions(SettingDefinitionProviderContext)'
AppSettingProvider already does that. Make sure you didn't modify the return type in that file.
Error CS0012 The type 'Object' 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'.
Update to VS2017 15.3.3+. For VS2015, install NETStandard.Library.NETFramework package.
Hello I am working on a Xamarin cross platform application using PCL for code sharing, and when I try to build the solution, I have the following error message:
Error CS0012 The type 'Attribute' is defined in an assembly that is
not referenced. You must add a reference to assembly 'System.Runtime,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I am targeting version 4.5 of the .NET framework. This error occured when I build, on a file generated in the obj folder.
I tried changing the references of the project but the only reference is "NET" (version 4.0.0) and I can't delete it nor add any other system reference so I don't know what to do.
I would like to programatically make a call with my windows phone 10, however I have no idea how to create a PhoneLine class can someone point me how to do it?
I am both new to C# and the mobile world.
I found the API reference here:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.calls.phoneline
and what I attempted to do is:
new Windows.ApplicationModel.Calls.PhoneLine();
However what I get is:
Severity Code Description Project File Line Suppression State
Error CS1069 The type name 'PhoneLine' could not be found in the
namespace 'Windows.ApplicationModel.Calls'. This type has been forwarded to
assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider
adding a reference to that assembly. App2 C:\documents\visual studio
2015\Projects\Helloworld2\App2\MainPage.xaml.cs 33 Active
As the error says ,
This type has been forwarded to assembly
'Windows.Foundation.UniversalApiContract, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'
Consider adding a reference to that assembly
You need to add Windows.Foundation.UniversalApiContract dll to the project as reference
If you read the error carefully you can see that it says this:
"This type has been forwarded to
assembly 'Windows.Foundation.UniversalApiContract,
Version=3.0.0.0,
Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider
adding a reference to that assembly."
You need to add a reference to the Windows.Foundation.UniversalApiContract assembly, as the class you are looking for has been moved over there instead.
According to this blog it can be found here:
C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\1.0.0.0\Windows.Foundation.UniversalApiContract.winmd
Remove (x86) from the path if you're on a 32-bit system.