Daniel Mitchell
Daniel Mitchell

Reputation: 57

Cannot resolve references in VS 2013, but they work in 2017.

The references work in VS 2017, but when my coworker checks the project out in VS 2013, the references cannot be resolved. I have done 'Update-Package -reinstall' and it is able to resolve the references in all but 1 of the projects in the solution. The NuGet Package manager says that the packages are installed. I have tried deleting the references from the solution explorer and adding them manually, but it still won't resolve. I've also tried clearing the package cache too and repeating the package restore. At my wits end with this. We need VS 2013 for code contracts stuff that isn't supported in 2017, otherwise I would tell my coworker to try updating. Any idea what would cause the references to not resolve?

Upvotes: 0

Views: 209

Answers (1)

Daniel Mitchell
Daniel Mitchell

Reputation: 57

I was able to fix the issue by removing this code from my .csproj file. I guess it is something unique to newer versions of NuGet that VS 2013 does not have. Hope this helps anyone else with a similar issue in the future.

<Import Project="..\..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets" Condition="Exists('..\..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" />
    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
       <PropertyGroup>
          <ErrorText>This project references NuGet package(s) that are missing on this computer. Use 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\NETStandard.Library.2.0.1\build\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets'))" />
</Target>

Upvotes: 3

Related Questions