Bug 18949 - NuGet update fails to match existing MSBuild imports in project
Summary: NuGet update fails to match existing MSBuild imports in project
Status: RESOLVED UPSTREAM
Alias: None
Product: Tools
Classification: Mono
Component: other ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks: 18837
  Show dependency tree
 
Reported: 2014-04-11 08:19 UTC by Matt Ward
Modified: 2017-08-31 15:58 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description Matt Ward 2014-04-11 08:19:42 UTC
To reproduce:

1) Create a new C# project that references an old version of a NuGet package that contains custom MSBuild targets or properties files (e.g. 'Test.Import.Foo').
2) Run/Debug nuget update on this project.

Expected result:

3) The old .targets/.props references should be removed from the project.

Actual result:

3) The old .targets/.props are still there.

<Import Project="packages\Test.Import.Foo.0.5\build\Test.Import.Foo.targets"/>

The problem is that NuGet compares the Project part of the Import element using the wrong path separate.

So it will be looking for "packages/Test.Import.Foo.0.5/build/Test.Import.Foo.targets" which does not exist. The code doing this check is:

https://github.com/mono/nuget/blob/2.8.1/Common/MsBuildProjectUtility.cs#L49

I believe that a change should be made to NuGet to fix this. MSBuild projects should use backslash for path separators regardless of the operating system. So NuGet should convert the original path.

Note: This has been logged under the Product: Tools, Component: Other. It may need to go somewhere else. Maybe Component: NuGet ?
Comment 2 Marek Safar 2017-08-31 15:58:50 UTC
Please report this issue upstream