Visual studio 2017 community not finding reference properly - c#

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.

Related

VS2019 RegPkg.exe throws Unhandled Exception

I've just installed Visual Studio 2019 with SDK and when i try to run RegPkg.exe, I see the following error. I don't have any other VS instances installed on the machine but I'm confused why the error is reporting about version 15.0.0.0 (which is VS2017).
Can someone please help me to resolve this error.
Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'Microsoft.VisualStudio.Shell.Framework,
Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
one of its dependencies. The system cannot find the file specified.
at Microsoft.VisualStudio.Tools.RegPkg.Main(String[] arguments)
I just noticed I got the exact same error message, using VS 2017's version. So it has nothing to do with the version you are using. I don't even have 2019 installed.
Microsoft simply broke their SDK, which has apparently been broken for 2 years, and no one noticed. For reference, I'm using VS 2017 15.9.7, also with the VSSDK installed.
I have a NuGet reference to that DLL in a VSIX extension I build, so I had a copy in my .nuget package cache ("%USERPROFILE%.nuget\packages\microsoft.visualstudio.shell.framework\15.9.28307\lib\net45\Microsoft.VisualStudio.Shell.Framework.dll"). I copied that version into the folder where regpkg.exe is located, and resolved the error (%VSSDK150INSTALL%\VisualStudioIntegration\Tools\Bin).
Probably not the best solution, but Microsoft needs to fix their product. I suspect it broke as part of their reorganization for the 2017 product, as they also added all the assemblies that extensions need for dependencies to NuGet. I guess they forgot to keep that assembly in the actual VS install folder.
EDIT: I've been looking into this more, and apparently the file actually exists in the lib sub folder right there with the exe. However none of the versions I've found actually work with CreatePkgDef.exe which was my backup plan, as it now throws this error instead:
CreatePkgDef : error : ArgumentException: No Visual Studio
registration attribute found in this assembly. The assembly should
contain an instance of the attribute
'Microsoft.VisualStudio.Shell.RegistrationAttribute' defined in
assembly 'Microsoft.VisualStudio.Shell.Framework' version '15.0.0.0'
Seems to work with regpkg.exe, though I haven't tried every combination of options.

You must add reference to assembly... without web.config file

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

Could not find Microsoft.Data.Tools.Components in VS2017

I successfully used VS 2015 (including c++ / c#) in the past and downloaded now the new VS 2017. Building the project, I got several warnings such as:
(1) Severity Code Description Project File Line Suppression State
Warning The referenced component 'Microsoft.Data.Tools.Components'
could not be found.
(2) Severity Code Description Project File Line Suppression State
Warning Could not resolve this reference. Could not locate the
assembly "Microsoft.Data.Tools.Components, Version=15.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL". Check to make sure the assembly exists on
disk. If this reference is required by your code, you may get
compilation errors.
(3) Severity Code Description Project File Line Suppression State
Warning Could not resolve this reference. Could not locate the
assembly "Microsoft.Data.Tools.Schema.Sql.UnitTesting,
Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL". Check to make sure the assembly exists on
disk. If this reference is required by your code, you may get
compilation errors.
I tried now several options. Actually, the solution explorer shows under references the "Microsoft.Data.Tools.Components". I then changed the .NET target framework from 4.6.1 to 4.5.1 and the reference path to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\SqlDb\ without no progress.
Maybe, some could help .. many thanks.
Not sure if this would resolve this problem or if Sepp ever found a solution, but this problem sounds similar to one I had upgrading to 2017 on other projects. Adding updated MS Libraries via NuGet has worked for me.
Open NuGet Package Manager and search for Microsoft.Data.Tools to find Microsoft content similar to Microsoft.Data.Tools.Components.
There are two similar entries Microsoft.Data.Tools.UnitTest and Microsoft.Data.Tools.MsBuild
Try adding maybe the Microsoft.Data.Tools.MsBuild or both to your solution and recompile. These libraries sound like they are the same base, and may include the 'Component' content also. A Google found the same issue (i.e. https://social.msdn.microsoft.com/Forums/en-US/09f82922-2fe5-46cc-bc70-b63f137aec28/visual-studio-2017-warning-issues-?forum=vssetup, and the Microsoft.Data.Tools.MsBuild package includes content similar to that mentioned both above and there. The MsBuild states: "You can use SSDT Transact-SQL design capabilities to build, debug, maintain, and refactor databases." - so I'm thinking this may be an update to your older set. If it doesn't work, just unselect them to uninstall.

DLL conflict when building Sitefinity 9.2 with visual studio

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.

project reference won't compile 'should be reference'

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.

Categories

Resources