-
Notifications
You must be signed in to change notification settings - Fork 1.1k
dotnet publish
Targets Different Frameworks when Publishing Multiple Projects
#16450
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
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Update: I add a actions/setup-dotnet step in my GitHub CI config to block the But I think the |
Update: The solution above still have problems on MacOS computers so I found this issue to solve this. According to this issue, a better solution now is to add a |
Update: Setting |
dotnet publish
Targets Different Frameworks when Publishing Multiple Projects
I'm not sure what would be causing this. Is it possible to get a binlog of the build that seems to be using the wrong runtime version (5.0.0)? |
Solved. I'll write down the cause of the problem and the solution here for latecomers. CauseJust use dotnet publish src/rmbox-shell/ --configuration Release --runtime osx-x64 will get
See CI#171. Use Let's take a look at the current project structure. But such behavior does lack a specific description. And then, in And next are several solutions to this problem. Solution 1: Add
|
Summary
Run
dotnet publish
for two different projects in one solution, and published artifacts targeted different frameworks (5.0.0
and5.0.4
). This causes the program to fail to start.Detail
Repo: Ruminoid/Toolbox / Tag: v0.2.0
My build process (Build.cs) triggers
dotnet publish
for each project in the solution, and sets self-contained publishing (L125) for the two executables rmbox and rmbox-shell. The CI log shows that rmbox (log) and the rmbox-shell (log) callsdotnet publish
using the same parameters, but the result executables targeted different frameworks (5.0.0
and5.0.4
) inruntimeconfig.json
.In published artifacts in the CI Build for v0.2.0:
rmbox.runtimeconfig.json:
rmbox-shell.runtimeconfig.json:
As a result, the dependencies (e.g.
coreclr.dll
) (version5.0.421.11614
) ofrmbox-shell
replaces the dependencies forrmbox
and cause it to rollback to find the framework installed on the computer, and finally fails to start.It's weird that if I runs the
nuke Publish
command (which execute Build.cs) on my computer, thermbox-shell.runtimeconfig.json
is the same asrmbox.runtimeconfig.json
, both are targeting version5.0.0
. So I think this may be a bug caused bydotnet/sdk
or the GitHub Actions.Here are a few reasons I think this is a failure caused by
dotnet/sdk
or GitHub ActionsI runs the publish command on my computer and found that the two executables both work properly.
This problem has been there since v0.1.6. The CI Build for v0.1.6 uses the .NET SDK version
5.0.201
(log) with the bug existing while the CI Build for v0.1.5 uses the .NET SDK version5.0.103
(log) with the program working properly.The text was updated successfully, but these errors were encountered: