Visual studio 2015 project missing all references

Visual StudioVisual Studio-2015

Visual Studio Problem Overview


Starting from today, a WPF project that belongs to a solution with 20 projects, set all my references to missing

enter image description here

I've just checked the MS suggestion and the other answers on Stackoverflow but none worked...I've tried to re-get solution from SVN, with no luck, other colleagues haven't got this problem. I've also tried to remove and re-add the references (System.Xml for example) . But no way to make it work...

Any suggestion? Thanks

UPDATE #1

Here's the csproj

 <ItemGroup>
<Reference Include="Catel.Core, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Catel.Core.4.2.0\lib\net40\Catel.Core.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Catel.Extensions.Controls, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Catel.Extensions.Controls.4.2.0\lib\net40\Catel.Extensions.Controls.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Catel.Extensions.FluentValidation, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Catel.Extensions.FluentValidation.4.2.0\lib\net40\Catel.Extensions.FluentValidation.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Catel.Fody.Attributes, Version=2.8.0.0, Culture=neutral, PublicKeyToken=1c8163524cbe02e6, processorArchitecture=MSIL">
  <HintPath>..\packages\Catel.Fody.2.8.0\lib\portable-net4+sl4+wp7+win8+wpa81+MonoAndroid14+MonoTouch40\Catel.Fody.Attributes.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Catel.MVVM, Version=4.2.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Catel.MVVM.4.2.0\lib\net40\Catel.MVVM.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="MethodTimer, Version=1.15.7.0, Culture=neutral, PublicKeyToken=cb1364609f40a1dc, processorArchitecture=MSIL">
  <HintPath>..\packages\MethodTimer.Fody.1.15.7.0\Lib\portable-net4+sl5+wp8+win8+wpa81+MonoAndroid16+MonoTouch40\MethodTimer.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.168.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="ServiceStack">
  <HintPath>..\packages\ServiceStack.4.0.46\lib\net40\ServiceStack.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Client, Version=4.0.46.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\ServiceStack.Client.4.0.46\lib\net40\ServiceStack.Client.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Common">
  <HintPath>..\packages\ServiceStack.Common.4.0.46\lib\net40\ServiceStack.Common.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43, processorArchitecture=MSIL">
  <HintPath>..\packages\ServiceStack.Interfaces.4.0.46\lib\portable-wp80+sl5+net40+win8+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="ServiceStack.Text, Version=4.0.46.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\ServiceStack.Text.4.0.46\lib\net40\ServiceStack.Text.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.IO.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Net" />
<Reference Include="System.Runtime, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Runtime.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="System.Threading.Tasks, Version=2.6.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\packages\Catel.MVVM.4.2.0\lib\net40\System.Windows.Interactivity.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Telerik.Windows.Controls, Version=2015.2.728.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
  <HintPath>..\packages\Telerik.Windows.Controls.for.Wpf.40.Xaml.2015.2.728\lib\net40\Telerik.Windows.Controls.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Telerik.Windows.Controls.GridView, Version=2015.2.728.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
  <HintPath>..\packages\Telerik.Windows.Controls.GridView.for.Wpf.40.Xaml.2015.2.728\lib\net40\Telerik.Windows.Controls.GridView.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input, Version=2015.2.728.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
  <HintPath>..\packages\Telerik.Windows.Controls.Input.for.Wpf.40.Xaml.2015.2.728\lib\net40\Telerik.Windows.Controls.Input.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation, Version=2015.2.728.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
  <HintPath>..\packages\Telerik.Windows.Controls.Navigation.for.Wpf.40.Xaml.2015.2.728\lib\net40\Telerik.Windows.Controls.Navigation.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Telerik.Windows.Data, Version=2015.2.728.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
  <HintPath>..\packages\Telerik.Windows.Data.for.Wpf.40.Xaml.2015.2.728\lib\net40\Telerik.Windows.Data.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
<Reference Include="WindowsBase" />

Yes I use Nuget, the other 19 points to the same assemblies ...nothing has been moved

UPDATE #2

Since I was not able to proceed I've copied the project from a colleague and now it works.... think something went wrong in the filesystem...have compared the solution and they were identical

Visual Studio Solutions


Solution 1 - Visual Studio

The resolution to this issue is.

Whenever you import a project to VS 2015 it modifies your .csproj. So, in order to fix it. Right click on .csproj and open it in notepad or any editor and delete the following

<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('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>

Then build your solution and it should work.

Solution 2 - Visual Studio

In the root directory of the solution, delete everything inside of /packages/ folder, then do a re-build.

Solution 3 - Visual Studio

It can help to force rebuild the nuget packages. Go to the nuget console and use the following commands: (TOOLS > Options > Package Manager > Package Manager Conbsole)

Update-Package -reinstall -ProjectName "MyProject" -safe

The safe parameter will actually not update the packages, but only reinstall them. If that didn't help, you can try to actually update them (but make sure you have a copy of the project somewhere, just in case.)

Update-Package -reinstall -ProjectName "MyProject"

To force update just one package, use:

Update-Package -id Microsoft.Package.Name -ProjectName "MyProject"

Solution 4 - Visual Studio

I had this once, caused by a broken .targets import. Check if you accidentally enabled nuget package restore (which includes a .targets file) and then deleted the .nuget directory.

Solution 5 - Visual Studio

I had similar issue. The solution, which worked for me was to pop the nuget package manager for the solution and refresh the packages.

Another case involved missing packages and nuget package manager for the solution showed updates and dependencies, which needed to be installed and this was the fix.

Another case was exactly as pointed above - delete packages folder fixed it.

Editing manually the project is an option, but there is a chance if you poke where you are not supposed to, your project may not open. If you can, avoid doing that is my opinion.

Solution 6 - Visual Studio

I've just experienced exactly this in VS2015 on a solution with around 20 projects. Only one project was affected and it lost all references including to the standard .NET assemblies.

The only way I could resolve was to switch to a different GIT branch and then back, this cleaned up the issue and it is all now working.

Solution 7 - Visual Studio

I also experienced exactly this in VS2015 on a solution with around 10 projects. Only one project - the main MVC project - was affected and it lost all references including to the standard .NET assemblies.

The problem was in my web.config. I had commented some lines, resulting in an invalid xml-file.

Solution 8 - Visual Studio

This error may occur if you miss .targets file in nuget packages folder. In my case it was packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets

Usually it happens when I'm adding packages to git repository (common .gitignore file is ignoring build folder everywhere) and checkout on another computer.

Tip: you can modify .gitignore file to include all files in packages folder. Append these lines to the bottom:

# Include all files in NuGet packages directory
!/packages/**/

Solution 9 - Visual Studio

For me I had mistakenly removed the following line from .csproj file:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

So I closed Visual Studio. Opened myprojectname.csproj file and added the line. then I reopened the solution and by that I was able to resolve my issue.

Solution 10 - Visual Studio

Unload project, then edit project

look for the following and delete.

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}.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionadvapiView Question on Stackoverflow
Solution 1 - Visual StudioGeorge SaadView Answer on Stackoverflow
Solution 2 - Visual StudioDon CheadleView Answer on Stackoverflow
Solution 3 - Visual StudioDamian VogelView Answer on Stackoverflow
Solution 4 - Visual StudioGeert van HorrikView Answer on Stackoverflow
Solution 5 - Visual StudioDrive4FunView Answer on Stackoverflow
Solution 6 - Visual StudioconnectedsoftwareView Answer on Stackoverflow
Solution 7 - Visual StudiotoraluxView Answer on Stackoverflow
Solution 8 - Visual StudioopewixView Answer on Stackoverflow
Solution 9 - Visual StudioShah AadilView Answer on Stackoverflow
Solution 10 - Visual StudioTholitz_ReloadedView Answer on Stackoverflow