Deploys the wrong files when project supports multiple runtimes
gingters opened this issue · 5 comments
I have a project that cannot be deployed to the pi, when multiple target runtimes are available.
When I have only <RuntimeIdentifier>linux-arm</RuntimeIdentifier>
set, and I do a dotnet publish
command, it works.
However, when I have set <RuntimeIdentifiers>win-x64;linux-arm</RuntimeIdentifiers>
and I do a dotnet publish -r linux-arm
, ssh-deploy deploys the wrong files (the framework-dependent project .exe) and not the self-contained Linux version.
I also did not find a way to pass the directory to deploy (in my case D:\Dev\sg\bsc-ampel\bin\Debug\netcoreapp3.0\linux-arm\publish
) to the tool. It always wants to deploy the wrong build.
I have to go back to only support one runtime, which makes local debugging extremely tedious.
Hi @gingters
Just as a test, could you please use SSH-Deploy from the command line.
- Comment or delete the Post Build Event lines from your csproj file:
<!-- <Target Condition="$(BuildingInsideSshDeploy) ==''" Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cd $(ProjectDir)" />
<Exec Command="dotnet-sshdeploy push" />
</Target> -->
- Open a command prompt and navigate to the path where your csproj file is.
- Run the ssh-deploy push command:
dotnet-sshdeploy push -c Release -r linux-arm
I tried that, and when doing it manually it deploys the correct files.
It seems the runtime identifier does not get correctly passed along from the task.
So, as a next step I also tried to amend the build target.
When I change the last exec to <Exec Command="dotnet-sshdeploy push -r $(RuntimeIdentifier)" />
it seems to deploy the correct files.
When I build for windows I don't want the target to execute too, so I needed to adjust the condition:
Condition="$(BuildingInsideSshDeploy) == '' And $(RuntimeIdentifier) == 'linux-arm'"
.
So, I think in this case it would help to simply update the documentation with the updated task passing the selected runtime identifier to the push command.
Created a PR that adds this information to the readme.
Yes, thanks a lot for the hint with passing the runtime identifier explicitely ;)