<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Sitecore.Kernel, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>N:\XXX\Sitecore.Kernel.dll</HintPath>
</Reference>
<Reference Include="Sitecore.Mvc">
<HintPath>N:\XXX\Sitecore.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>N:\XXX\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>N:\XXX\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Providers">
<HintPath>N:\XXX\System.Web.Providers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>N:\XXX\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>N:\XXX\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>N:\XXX\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>N:\XXX\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
I found some solutions saying that a mscorlib wasn't referenced.. but when I tried to add it it sayd that it's already there (even though I don't see it on the csproj file).
System.dll reference:
–
–
–
–
I had the same problem earlier when I tried to edit an open source project from the internet.
Solved it by just Cleaning the solution and rebuilding it.
–
–
–
right click on Solution > Restore NuGet packages
right click on Solution > Clean Solution
right click on Solution > Build Solution
Close Visual Studio and re-open.
Rebuild solution. If these steps don't initially resolve your issue try repeating the steps a second time.
Thats All.
–
–
–
I attempted to re-create your issue and came up with a similar error when the solution was created in visual studio 2013 and then tried building it in in vs 2015.
I was able to get a successful build once I reinstalled NuGet Package Manager (and closed, then reopened VS 2015).
References / Credit
There are several SO questions relating to build issues via with earlier version of NPM for VS 2015 (i.e. I'm just passing along what I've tried and worked out). Recurring resolution is usually update / reinstall NPM or change execution policy in power shell. I tend to like the update + restart approach to avoid tinkering with the black boxes in windows. one source: https://stackoverflow.com/a/32251092/1158842 There may also be an issue of MSBuild Integrated solutions, in which case migrating away from the NuGet resources in the solution could do the trick.
Source: https://stackoverflow.com/a/31811461/1158842
If cleaning the solution didn't work and for anybody who see's this question and tried moving a project or renaming.
Open Package manager console and type "dotnet restore".
right click you project name then open the properties windows.
downgrade your Target framework version, build Solution
then upgrade your Target framework version to the latest, build Solution .
–
Open Project References, I had lots of yellow warning triangles on the various packages.
Click Add Reference, just doing that seems to get VS to refresh it references, and the yellow triangles disappeared and the errors from the code also.
You might have to do this in a few projects if your solution reference to other projects
For the folks that like me got here because they're trying to host aspnet.core mvc in a console application:
The ONLY way I was able to solve this was by converting the .csproj to the new format and add the Sdk property to the Project tag on the very first line.
<Project Sdk="Microsoft.NET.Sdk.Razor">
For me it only happened in one project and I tried everything I found online and nothing seemed to help.
I was ready to delete and recreate the project when after messing through the projects properties changing the .NET framework target from 4.7.2 to 4.8 fixed the issue. I changed it back to 4.7.2 later and the error is gone.
Hopefully this helps other users as well.
i had to upgrade from visual studio 2017
to 2019
. no other proposed solution here helped me, i installed and configured, rebooted every one here plus many other options from ms site.
my root cause was probably due to the fact the git repository developer used 2019 and i tried to clone the original git repo into ma 2017.
–
I've tried all answers above. For me works only removal and adding the reference again described in the following steps:
Open 'References' under the project.
Right click on 'System' reference.
Click on 'Remove'.
Right click on 'References'.
Click 'Add Reference...'.
From right menu choose an 'Assemblies',
In a search field type 'System'.
Choose 'System' from the list.
Click 'Add' button.
IMPORTANT: Restart the Visual Studio.
This happened to my project because base folder had html encoded characters because of git clone, ex: instead of "PROJECT NAME" it was "PROJECT%20NAME" on Windows.
Changing it manually to "PROJECT NAME" and re-opening the .sln fixed it for me.
Right Click on Project => unload Project
In the .proj file that should open, delete (or comment out) the error conditions
Reload Project
I encountered this message while trying to extract part of a solution to set it up as a stand-alone solution.
I found that all the <HintPath>
references in my .csproj files were now pointing to the wrong place. In my case they were originally:
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
And to make the compile problems go away, they just needed to be fixed up as:
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
In case this helps someone, in my case, the previous owner of the project had failed to ignore the packages directory in source control, but had ignored the build paths, so while the packages were incomplete.
To fix, I had to
Build the solution to see what package was missing.
Delete the packages from the hard drive.
Run update-package -reinstall -ignoredependencies from the NuGet console.
my problem was caused because several projects were used and compiled by 2 separate vs2019 solutions.
once i merged the solutions and deleted the obj & bin folders and recompiled - the problem was solved
Interesting thing I came to know, about nuget references in Visual studio
For nuget references, we can add As through reference or by package.config file.
In Visual Studio 2017 - the alphabetic order or nuget reference is taken care by VS automatically.
But In Visual Studio 2019. if you nuget references are not in alphabatic order than VS doen't loading the file in Reference folder.
So in order to try to fix.
--Remove all the All references from
.csproj/vbproj or package.config.
-- save in notepad. Try to add those through Nuget Package Manager.
-- Try with 1 first time. and once installed.
-- Right click on Solutions -> Restore all nuget packages.
-- You will see now it loads one nuget reference.
-- Now do this one by one.
-- if you 100% sure that your order of references are in alphabetic
order. Just paste them all in .csproj/vbproj or package.config.
-- Restore all nuget on solutions.
You will see all the symbols will be loaded.
-- one more thing Refresh you Reference folder by a top icon in solutions explorer.
Happy referencing.
Using VS Professional 2019, I was trying to run a downloaded solution from a Udemy class on selenium automation testing, and most of the projects had errors in the project references sections. I tried cleaning, rebuilding, closing VS. Then, in VS, when I right clicked on the solution in Solution Explorer and chose Manage Nuget Packages for Solution, there were 2 available updates: for MSTest.TestAdapter and MSTest.TestFramework, and when I installed those, the error messages on the references for all the projects went away, for the references to those, as well as for the references to System and System.Core.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.