Publish A Project That Reference To Another Project To Output DLL To `libs` Dir
Hello,
I have a project X that compiles as library (DLL) with has a lot of nuget packages. This project used as utils for my other project, project A.
Project A is a winExe project, self contained that I want to publish. Upon publish, it builds project X than project A.
I want to put all the produced deps DLLs in project X into a directory named
libs
As for now, it does puts it there but the application cannot run and says that I need to install the dotnet runtime.
(csprojs in comments)18 Replies
Project X csproj:
Project A csproj:
That sounds like a bad idea. Why do you want this?
Just so I understand, you want to move the DLL files produced by project X into a
libs
folder in Project A?
You already have a project reference, what is wrong with that?But if you really want this, you could probably create a Post-build event
Specify build events (C#) - Visual Studio (Windows)
Use build events in Visual Studio to specify commands that run before the build starts or after the build finishes for C# programs.
@FusedQyou
project X is a a library that has a packages in it that used by project A that references it.
When publishing project A, the published folder is full of dotnet runtime dlls that looks massy
Well it's not supposed to look good
I think the better question is "how can I make sure that my project dependencies build into a different folder"
Yeah.. It can be defined like that too
mind that it's not only the project X, but the self contained dotnet runtime
One thing my company does is just not reference dependencies and instead it builds everything and specify the build path to (in this case) go into Project A and into a
libs
subfolder
But this sucks because you should just use proper dependenciesA quick Google search gives me this: https://github.com/nulastudio/NetBeauty2
GitHub
GitHub - nulastudio/NetBeauty2: Move a .NET Framework/.NET Core app...
Move a .NET Framework/.NET Core app runtime components and dependencies into a sub-directory and make it beauty. - nulastudio/NetBeauty2
Maybe you can use this as a Post-build event
I am familiar with netbeauty, I thought maybe there's a native solution to it
Doubt it
maybe move all the dll to a libs folder and redirect the application to look for dependencies in libs
This type of question is usually not really considered because you're not supposed to look at this anyway
FWIW, I'd argue there's no folders at all and everything is inside the root
Can't I alter the produced
App.runtimeconfig.json
to let it probe in lib path?
yes, should I exlude it?
there are like 10 of them 😄What about this solution?
https://stackoverflow.com/a/72044506
Stack Overflow
Additional probing paths for .NET Core 3 migration
Short version of the question:
Is there any way in .NET Core 3 to specify a local probing path, using the same rules as the <probing> element from app.config? additionalProbingPaths does not ...
I'll check that.
I can do something else and publish it as SingleFile
but that the issue is that I cant work on the root dir file since every actions made for the root folder (create a file from the exe) results in the creation of it in %temp%
Sounds good, I don't produce and pdb file in publish
Yeah I tried it, same issue
For which on of them?
.NET8
Oh I used
CodeBase
I ran it now and it seems to work
What is the cons of selfcontained+singlefile beside changing the code where I access the root folder
wdym by native dlls?
It sound that the most stable option is to be self contain and have these long list of dlls in the root
Yeah, the cons are one up on the pros on this one
I just wanted to make my users to not to install the dotnet runtime
anything else is an extra, also the tidy root folder