简体   繁体   中英

Missing references errors on Visual Studio 2015

I have a solution with a project that i developed using Visual Studio 2013 and it was working as intended. I then formatted my computer to upgrade to Windows 10 and decided to install Visual Studio 2015 instead and now I'm getting a lot of missing reference errors when they are installed, does anyone know why this is happening and how to fix it?

Some of the errors:

错误

A good example is that I have Microsoft.Net.Http package installed but it's not recognizing it where I have using System.Web.Http;

I installed Visual Studio 2015 with the same user I'm using to run it (It's a personal computer and I'm the single user) and am running it as administrator.

If you need any extra information please leave a comment and I'll edit the question.

如果缺少或匹配的软件包问题,则软件包管理器控制台中的Update-Package可能会对其进行整理

I had the same issue a few months ago. In my case the following two steps worked:

1) Delete the hidden .vs folder from the solution folder, it's next to the .sln file (but close visual studio first)

2) From the .csproj file, remove these entries (if they exist)

<RestorePackages>true</RestorePackages>

And

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>

最后,我创建了一个新项目,然后只复制了文件,并从旧项目中复制了几行配置,这为我解决了问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM