Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy in trailing backslashes in NuGetPackageFolders #6032

Closed
bjorn-ali-goransson opened this issue Oct 14, 2017 · 5 comments
Closed

Comments

@bjorn-ali-goransson
Copy link

Hello,

Using latest VS 15.4.0, Nuget package manager 4.4.0, I have started getting an error when trying to build a project referencing a Nuget package containing this .targets file:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <None Include="$(NuGetPackageFolders)\SweekCms.Admin\1.0.24\content\sweek-admin.tar">
      <Link>sweek-admin.tar</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>

Error is:

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4406,5): error MSB3025: The source file "C:\Users\Bjorn\.nuget\packages\" is actually a directory.  The "Copy" task does not support copying directories.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4406,5): error MSB3030: Could not copy the file "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\SweekCms.Admin\1.0.10\content\sweek-admin.tar" because it was not found.

This worked in june. When looking at the obj\WebApplication1.csproj.nuget.g.props I see that the NuGetPackageFolders value is:

<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Bjorn\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>

ie. a discrepancy in trailing backslashes. When changing the .targets file to utilize NuGetPackageFolderRoot, it started working again.

Looks a bit like this comment here: dotnet/sdk#1250 (comment)

I fixed my issue, but giving a heads up in case something is wrong here?

@bjorn-ali-goransson
Copy link
Author

Background: #5237

@emgarten
Copy link
Member

@bjorn-ali-goransson the issue is that NuGetPackageFolders contains multiple semi colon delimited folder paths and your example tries to use it as a single path.

C:\Users\Bjorn\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder

Beyond that it does look like NuGet should normalize these paths and add a trailing slash to make these easier to use. Currently I believe theses are written out as they were provided by the project. The fallback folder here comes from a project property in the SDK.

@bjorn-ali-goransson
Copy link
Author

That's very interesting, thanks for the information!

@rrelyea rrelyea added this to the Backlog milestone Oct 23, 2017
@rrelyea rrelyea added the Priority:2 Issues for the current backlog. label Oct 23, 2017
@rrelyea
Copy link
Contributor

rrelyea commented Oct 23, 2017

Work here for us to (either us or the SDK team) normalize the paths to not have trailing slashes.

@nkolev92
Copy link
Member

nkolev92 commented Nov 7, 2020

Dupping to #7968.

I understand that it's newer, but it contains more relevant links.

@nkolev92 nkolev92 closed this as completed Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants