-
Notifications
You must be signed in to change notification settings - Fork 426
Wrong reference path in NETStandard.Library.targets #708
Comments
@cannehag @elementalpete his cause any issue beyond a warning? |
It would also help to understand if you get the same warning from the command line, or is it only in Visual Studio. Please share more information about where you are seeing the warning and what product you are using. |
I am running Visual Studio 2017 (updated to latest version today, 4/16/2018). This is on a Windows Service targeting .NET Framework 4.6.1 that references a .Net Standard class library. I see the warnings in the Error List and also under the project References in Solution Explorer, but after upgrading again, I had to play around to get the warnings to reappear (I think that drilling into References as shown on the right of the screen capture is what triggered them to reappear in Error List). I'm not sure where to look in the command line as this is not a .Net Core project... I am attaching a screen shot that shows the issue, including the location of the double slash. As far as I can tell, these are only pesky warnings - I believe that my project is still running fine. |
Looking at that path it appears to be occurring from your .NET4.6.1 project which uses packages.config (I'm guessing based on the path that uses a local packages folder with the package version in the folder name). Is that correct? Can you see if NuGet made any changes to the project file? Where did you update the package: the .netstandard project or the .net 4.6.1 project or both? The odd thing is that those targets shouldn't add any references in a .NET 4.x project, due to the condition:
But that appears to be what's happening here. It's actually similar to dotnet/project-system#1542 which makes sense: desktop projects use the old project system. I did change the way these items are defined, and its possible we got lucky with this behavior in 2.0.1. I'm pretty certain the double |
Yes, I'm not overly worried at this point - I was investigating an unrelated issues as was alarmed by all of the "file not found" warnings, but it seems to be the warning that is inaccurate, not the build process. I just commented since the issue was not reproducible. I performed the update from NuGet package manager, and updated all (stable only) packages in the solution, so the update occurred in both projects at the same time. The packages.config and the MyProject.csproj seem to be different only in the version numbers. I can't figure out how to do a compare on the project file because .csproj files can't be viewed while the project is loaded, but this seems to be the relevant part:
|
I'm experiencing this same issue. Nothing from command line builds, it's only in Visual Studio. And even in VS, the project(s) still compile and run without issue. It's just annoying from a visual perspective. |
Ok, I have a consistent minimal repro:
It is indeed the project system doing an evaluation of the project without evaluating conditions. Choose/when seems to be a trick to short circuit. To workaround you may change the targets inside the package from
to
I'll submit a PR for this workaround. |
Same issue here. I tried deleting the references but that's only a temporary fix. They come after a while (probably when running a Package-Update) |
Reopened for release branch fix. |
I'm having this same issue. My libraries exhibiting this behavior are targeting Full Framework 4.6.1. As others have said, the solution still compiles and appears to run fine but it's disconcerting seeing all those warnings. If I delete the bogus references they end coming back the next time I open the solution. Screenshot of the broken references: Screen shot of all the warnings: This appears to be the relevant part of my .csproj file for one of the class library projects:
Is there a way for me to edit this .csproj to make all the warnings go away? |
See my comment here: #708 (comment) Alternatively you can pick up NETStandard.Library 2.0.3 from https://dotnet.myget.org/F/dotnet-core/api/v3/index.json which has the fix. We'll be publishing to NuGet.org shortly. |
This if fixed in the release branch now so closing. |
NETStandard.Library 2.0.3 is now on nuget.org. |
how do we get that for shared projects in xamarin forms ? I am able to install it on xamarin android, uwp and ios but I am not able to do it for shared project. it always stands "blocked by project" and when I try to change directly editing the proj file, it tell me that my current net standard installation doesnt support it. but i have the latest version of VS2017 and net standard and net core installed. |
@ericstj Is there any way to workaround this in a UWP application that uses Microsoft.NETCore.UniversalWindowsPlatform 6.1.4? This package has a dependency on NETStandard.Library 2.0.2. |
/cc @zamont |
Version 2.0.3 gives same error: "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 ....\packages\NETStandard.Library.2.0.1\build\NETStandard.Library.targets." |
@rubenc57 can you please close/reopen your solution and then rebuild the project? I think this will help VS understand that it needs to refresh its build targets that come from the NuGet packages. |
@zamont I already did that and same error |
If it's not too bothersome for you, could you clear your NuGet cache by doing
and then rebuild? |
Actually it sounds like you have automatic restore disabled. Either enable it in package manager settings or right click the solution node in vs and choose restore. |
@zamont "Clear All NuGet Cache(s)" --> Same error |
Interesting. It actually looks like something is confused between packages.config and packagereference. |
Problem was on project file... I removed old imports and worked Thanks for the help |
I see, yeah that can happen with the old package.config based nuget. It's quite fragile since it mixes user state with package state (writing to the project file) then stores install state in packages.config. If any of these views is out of sync then it'll do the wrong thing on an upgrade, or if it can't find the data it previously wrote in the project it will abandon it, etc etc. I'd really recommend moving to PackageReference if you can. |
I have same error on UWP (for Windows IoT) application project created in VS 2017 15.7.2 with UWP nuget 6.1.4 (I tried also 6.2 preview). I have referenced .NET Standard 2.0.3 assemblies and have warnings like below. I tried to clear nuget references but it not helped and all .net standard libs have csproj not packages.config. |
After updating to NETStandard.Library 2.0.3 you may need to unload and reload the solution in Visual Studio as it is the project system that has the stale state. I believe @zamont and @HollyAM are working on an update to the UWP package. |
How can I unload solution - you mean VS restart? I can unload project - I tried to unload every project and reload again with clean nuget cache and restart VS and nothing is helping. |
After updating NETStandard.Library to version 2.0.3 I get this error when trying to build my ASP.NET MVC project:
If I try to uninstall 2.0.3 and install 2.0.2, I get the same problem. I have to revert back to 2.0.1. Very frustrating. |
I fixed the problem by deleting .vs folder from solution. I restarted VS two time and problem is not repeating. |
If you install UWP 6.1.5, you will get the fix. You can get it on nuget: Microsoft.NETCore.UniversalWindowsPlatform |
I tried deleting the .vs folder from solution, but problem was still happening. |
Hmm I also updated to UWP 6.1.5 so maybe that was the magic trick not .vs :) |
I am also facing the same issue with one of the Xamarin android project "If I try to uninstall 2.0.3 and install 2.0.2, I get the same problem. I have to revert back to 2.0.1." Nothing worked other than the solution mentioned by @pmarangoni (VS2017 Community edition) |
Package 2.0.3 resolves the warnings in the IDE. Here are the sorts of things you must do when updating the package:
If anyone is still seeing the problem after the following the steps above, please open a new issue with repro steps and we will look into it. |
I'm still seeing this problem even after reloading solution. Frustrating. |
If you're still seeing a problem please open a new issue with full details of repro steps. I'll be happy to look into it, but I need more data. Thanks. |
I deleted this code in .vbproj file and the error went away.
|
I keep running into dotnet/standard#708 and this is apparently fixed in 2.0.3
And somehow we call this progress.... |
@cannehag commented on Thu Apr 12 2018
After installing NetStandard.Library 2.0.2, a lot of warning occur.
NetStandard.Library.targets 2.0.2 have
<Reference Include="$(MSBuildThisFileDirectory)\ref\Microsoft.Win32.Primitives.dll...
According to documentation MSBuildThisFileDirectory will include a final slash, thus giving a path with double slash and the error message
The referenced component 'C:\Users\xxx.nuget\packages\netstandard.library\2.0.2\build\netstandard2.0\ref\Microsoft.Win32.Primitives.dll could not be found'
Version 2.0.1 does not have this issue since the targets file is including *.dll from another path
@elementalpete commented on Mon Apr 16 2018
I experienced the same issue after upgrading (path in warning message contains a double slash, actual path has only a single slash). Downgrading to 2.0.1 solved the issue for now.
The text was updated successfully, but these errors were encountered: