Include WinSCP with PackageReference copies .exe in MY package

Advertisement

danimonsi
Joined:
Posts:
2

Include WinSCP with PackageReference copies .exe in MY package

Hi all

I have a problem with the WinSCP.exe file in my created NuGet package.
I reference WinSCP in my project as follows:
<PackageReference Include="WinSCP" version="5.17.10" />
After packing my NuGet package, the winscp.exe is copied to the package in contentFiles. When I reference my package in other projects/NuGet packages, the winscp.exe is also copied into the package. I don't like that, because I want to use the references and download it while package restore (obviously).

But I don't know how I can exclude the .exe from my package.

I tried this:
    <PackageReference Include="WinSCP" version="5.17.10" >
      <PrivateAssets>none</PrivateAssets>
      <IncludeAssets>all</IncludeAssets>
      <ExcludeAssets>contentFiles;build;runtime;native;analyzers</ExcludeAssets>
    </PackageReference>
This works for the first/lowest package, the .exe isn't copied and the reference is set in nuspec.
But for higher packages, which reference MY package (with reference WinSCP in nuspec), the .exe file isn't copied.

One workaround is as far as I can see, that I add for each package which is using my first/lowest package, the same reference again:
    <PackageReference Include="WinSCP" version="5.17.10" >
      <PrivateAssets>none</PrivateAssets>
      <IncludeAssets>all</IncludeAssets>
      <ExcludeAssets>contentFiles;build;runtime;native;analyzers</ExcludeAssets>
    </PackageReference>
But I don't think, that is the intended way..

Thanks for any help.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Include WinSCP with PackageReference copies .exe in MY package

Sorry, that's beyond by NuGet knowledge.

Please consider asking elsewhere. Maybe Stack Overflow? Post a link here if you do.

Maybe something needs to be changed in the WinSCP package.

Reply with quote

danimonsi
Joined:
Posts:
2

Hi Martin

Okay, thanks. I am asking it on Stack Overflow:
Including WinSCP with PackageReference copies Winscp.exe in MY package
I don't know, if it's a problem with your NuGet definition. I am new in this "nuget" topic, but I haven't seen any other package with the folder tools yet. And I'm creating packages also with .exe files in the lib folder and the reference-process in other packages works as expected. The reference is added, but the .exe and .dll files aren't stored in the package, but are downloaded while package restore.

Maybe Stack Overflow knows more... thank you and have a nice day.

Reply with quote

Advertisement

You can post new topics in this forum