I’m using visual studio 2015 to write in c#.
I have a logic project which is a class library (package), and UI project which is console application (package) and I’m connecting the two with reference.
I have the error: CS0012 The type object is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
I’ve searched online and the solution I’ve found was to change the web.config file, but I don’t have one. Another solution was to add reference to System.Runtime.dll but it made 1135 errors when I did that, such as “Predefined type System.Object is not defined or imported”. So what other solutions there are?
I don't have VS 2015 installed right now. But from what I remember it's the same than 2017 :
Project > References > Add reference > Assembly
Related
I cloned a project on github and while trying to compile, it gives me missing assembly reference error but the said assembly is within the project and seems to be just fine.
Error CS0012 The type 'ValueType' 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'. UndertaleModTool Converters\RectConverter.cs 16
ValueType is within the dependency ValueTuple.
Screenshot
Tried re-installing, updating and setting in the csproj file but i wanted to find a clean solution for this problem; other people seem to be able to compile the project just fine.
Any ideas on how to solve this kind of issue?
link of the project on github for reference https://github.com/krzys-h/UndertaleModTool
Download clean project from github
Then try restoring nuget packages for solution demonstrated in screenshot
I've solved the issue in this way. Mine is running property with 3 warnings
Seems to be a Visual studio 2017 community bug, installing vs community 2019 fixes the issue entirely without having to do anything.
I have to use a DLL as an API in my application (C#, .NET 4.5). I can reference the DLL normaly. No error at all. But if I want to use any class of this DLL, I get the following compile error:
Error CS1705 Assembly 'Assembly_X' with identity 'Assembly_X,
Version=12.3.0.0, Culture=neutral, PublicKeyToken=c878e80841e75d00'
uses 'Assembly_YY, Version=65535.65535.65535.65535, Culture=neutral,
PublicKeyToken=c878e80841e75d00' which has a higher version than
referenced assembly 'Assembly_YY' with identity 'Assembly_YY,
Version=12.3.0.0, Culture=neutral, PublicKeyToken=c878e80841e75d00'
Then i checked the DLL (Assembly_X) in ILSpy. The Assembly_X has two references to Assembly_YY: One with the version 12.3.0.0 and one with the version 65535.65535.65535.65535.
I tried the "bindingRedirect" in the App.config. But since the error occures during compile time this doesn't help.
I don't have the source code of Assembly_X or Assembly_YY.
How can I use this DLL or repair it?
UPDATE
The developers of the dll finally answered my call for help. The only work around they know of is to use Visual Studio 2013 instead of Visual Studio 2015 or 2017. It seems VS 2013 is not bothered by these double reference at all.
They write, that the error is created by a encrypting tool for the dll.
Thank you all for your ideas and help.
It looks like the first DLL is referencing a library which is a higher version than the other DLL you are using.
so you have 3 DLL's to consider: A, B & Bv2
Your project is referencing A & B
But A references Bv2 (an updated version of B)
SO when you go to use functions of A it throws an error because it finds B instead of Bv2.
The problem basically that you are referencing 'Assembly_X' which references assemblies 'Assembly_YY' versions 12.3.0.0 and 65535.65535.65535.65535 and you referenced only 'Assembly_YY' version 12.3.0.0 in your application and didn't reference 65535.65535.65535.65535
Now according to the problem explanation on Microsoft Docs, and your example which you don't have the source code for the assemblies you have to:
Add a reference to 'Assembly_YY' version 65535.65535.65535.65535 of the DLL to your application to make it compile and to enable the application to run, you can provide an application configuration file that includes a <dependentAssembly> element that uses <assemblyIdentity> and <codeBase> child elements to specify the location of version 12.3.0.0 of the DLL.
You are referencing a higher version of DLL then the one you currently have.
You will need to add the reference to the higher version assembly:
'Assembly_YY, Version=65535.65535.65535.65535, Culture=neutral, PublicKeyToken=c878e80841e75d00'
in order to solve this.
Right now you are referencing
'Assembly_X' with identity 'Assembly_X, Version=12.3.0.0, Culture=neutral, PublicKeyToken=c878e80841e75d0
If this is a downloadable library, search for it in the nuget package manager and download it.
If it's a library written by you, obtain the latest version of the library and add it to your project.
When building an instance of Sitefinity 9.2 using visual studio 2013 I get a DLL conflict error.
There was a conflict between "Telerik.Windows.Documents.Core, Version=2015.1.225.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" and "Telerik.Windows.Documents.Core, Version=2016.2.421.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7". (TaskId:7)
The DLL that is causing the issue is their own DLL
References which depend on "Telerik.Windows.Documents.Core, Version=2016.2.421.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" []. C:...\bin\Telerik.Web.UI.dll (TaskId:7)
Project file item includes which caused reference "C:...\bin\Telerik.Web.UI.dll". (TaskId:7)
The included DLL for Telerik.Windows.Documents.Core is the older version 2015.1.225.40 and not the newer 2016.2.421.40 version.
Is there a way to resolve this in the web.config (like a binding redirect) or some other method? Being that it is a vendor application should they provide the correct DLL version?
I would check your references on the SitefinityWebApp project. In some cases I found that you have to delete the reference and then re-add it back. Also, if you have other projects part of your solution you will need to check those projects for references to that assembly.
Also, something to look into, Sitefinity will allow you to use NuGet packages to manage the assemblies and project references in your solution. You can see more details about this at the following link...
http://docs.sitefinity.com/upgrade-a-project-that-has-nuget-packages
Hope this helps.
In the following new test project I've created for testing the web code I have the following error when trying to compile my code.
Not sure what this means because I've added the reference to the project including the controllers into the test project??
Any ideas
Many thanks,
James
Error message
Error 330 The type 'Web.Supporting.BaseControllers.PowerController' is defined in an assembly that is not referenced. You must add a reference to assembly 'Web.Areas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. C:\Power\Test.Unit.Web.Portal\Controllers\SearchProductControllerTests.cs 39 13 Test.Unit.Web.Portal
UPDATE
Tried adding system.web.mvc into the test project although I can't see it, see image below
UPDATE
Found it by looking at an existing test project. Can't see it in the dialog (???) but I located it here: C:..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll
Did you include reference to Web.Areas library which it is asking for? If not add it.
If you already have a reference to it then "Target Framework Version" will be the problem. If your current project is targeted to lesser version than the referenced assemblies this will happen. Ex: If current project targets to .net4.0 and Web.Areas is targeted to .net4.5 this error will appear.
To fix it you may need to downgrade all other projects version or upgrade current project's version.
To resolve this I added a reference into the test project for the PowerController dll and also the system.web.mvc. Note: system.web.mvc is in the extension tab of the 'add reference' dialog.
I am on .NET Framework 4.0, building a C# web application in VisualStudio 2012. I have Microsoft.VisualBasic added as a reference to the project. I am having trouble with the following line of code:
using Microsoft.VisualBasic.FileIO;
Building the solution returns the error: The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' (are you missing an assembly reference?)
I have removed and re-added the reference to the assembly Microsoft.VisualBasic, but still get the error. Microsoft.VisualBasic is in the GAC, as well as Microsoft.VisualBasic.Compatibility, Microsoft.VisualBasic.Compatibility, Microsoft.VisualBasic.PowerPacks.Vs, and Microsoft.VisualBasic.Vsa.
Please let me know how to get VS2012 to recognize the FileIO namespace.
Right-click on your project and select Add Reference...
In the Reference Manager, expand Assemblies and select Framework. Then check the box for Microsoft.VisualBasic and click OK.
I had similar issue, fixed by change TargetFramework (in .csproj) from netstandard2.0 to netcoreapp3.0.
Application references are not available to uncompiled files in your application (aspx, ashx). There are two solutions to this issue as follows:
1) Move your code to a compiled part of the application (cs/vb file)
or
2) Add the reference to the web config
My reference was in an ashx file. I simply copied the code from the ashx file to the clipboard, deleted the file from the project, added a new Generic Handler (right click in Visual Studio > Add > Generic Handler), entered the same name as before, and pasted the code from the clipboard into the cs file editor that Visual Studio opened. I now have a cs file that will compile with the project and use the project reference. The file name is the same, so there is no need to update anything else -- just rebuild and deploy.