I have some project which has some exe as "dependency" and I build that project as nuget package from .csproj
file
File looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>1.1.2</Version>
<PackageId>MyLib</PackageId>
<Authors>me</Authors>
<Company>me</Company>
</PropertyGroup>
<ItemGroup>
<None Remove="CliInterface\32BitInterface.exe" />
</ItemGroup>
<ItemGroup>
<Content Include="CliInterface\32BitInterface.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>analyzers;build</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
When I use that nuget package inside some other solution I can see file is there
However it is not copyed to output folder.
In fact, to be correct it is when I run Build
project from Visual Studio
, but I use dotnet build
command in my CI/CD
environment and it is not copied to output when I run that command.
EDIT: I also noticed that location of that exe is inside %USERPROFILE%.nuget folder and also my csproj file (from other solution, that references that nuget package) has hardocoded path with my username inside it. I'm not sure why is that the case but don't like that