NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 250 forks source link

Files are not added to a csproj if they are already exists in a directory. #6696

Open ievgennaida opened 6 years ago

ievgennaida commented 6 years ago

I use TFS and visual studio 2017. Package Manager Console Host Version 4.5.0.4685

I have two files distributed with my package: Properties\A.snk and Properties\Template.txt. And there is no way to add those with nuget if they were excluded from csproj file. (csproj was not properly merged or files with such name already exists. )

Nuget never checks the csproj reference before they will be skipped.

I thought that reinstall suppose to fix this issue but it's not:

'Properties\A.snk' already exists. Skipping...
'Properties\Template.txt' already exists. Skipping...

So package is updated but there is no check that we should include those files back to a csproj.

 <ItemGroup>
    <Content Include="Properties\Template.txt" />
  </ItemGroup>
ievgennaida commented 6 years ago

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

StingyJack commented 6 years ago

Are you using this for private packages?

ievgennaida commented 6 years ago

@StingyJack Hi. We have own server with project packages. Common assembly distributes snk file for our projects.

StingyJack commented 6 years ago

Depending on the version of nuget you are using, you could use an install.ps1 script to update the project items or force the copy-ing of replacement files from the package.

If its just for in-house stuff, you may also be able to make a code fix extension for VS that gives you warnings when the project doesnt have these files.

ievgennaida commented 6 years ago

@StingyJack Thanks for a suggestion, probably we will do it locally. Anyway, I believe that NuGet -reinstall should do this job without additional efforts...