How to publish a project with different configurations than its dependencies #7725
Unanswered
glen-nicol
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
After being stuck on .Net framework through the entire dotnet core era, a complex desktop application I maintain is migrating to .Net 6. I am very excited about getting into the modern era for this project! Thus far it has been largely painless to make the switch. So thank you to everyones hard work to make that easy! However, I have finally hit a snag that doesn't seem supported.
This application has multiple top level targets. Each of those targets has its own project. Each of those projects has 4 configurations for various release channels. In the past we have used the solution to manage how those configurations link to the library projects which just have the standard Debug/Release configurations. It is basically the same problem as this SO but sadly I don't think the solution there is workable for a solution of our size.
The problem was discovered when I tried to publish the app. I first tried building the solution, and then publishing the solution with --no-build which gave me strange msbuild task errors. Then I found a couple places that say publishing a solution file isn't recommended. So I tried to build the whole solution and then publish the specific top level project with --no-build specified. But that failed with errors about not being able to find files in dependent projects because it was expecting the same global configuration in all projects. I found this SO that suggested recreating the solution with extra attributes on ProjectReference, but that seems to require me to define it on all of them in the whole solution to avoid the global property from leaking back in at dependencies of dependencies.
I found that I could just build all the projects with the top level configuration and then publish them. But then this has drawbacks:
The last option for this project is just to forego the opportunities of publishing (ReadyToRun, Trimming, maybe Self contained deployment) and just build like we used to and then pick the files out of the normal solution output.
Is there a better way? Am I missing something obvious?
Again, thanks for everyone's hard work!
Beta Was this translation helpful? Give feedback.
All reactions