- Notifications
You must be signed in to change notification settings - Fork1.4k
-
I've got the following setup: LibraryProject is a .NET library referenced by .NET MainAppProject. Now, I want the output of ToolProject be available for the MainApp (as a transitive dependency of LibraryProject). For it, I tried using in LibraryProject.csproj, but this way only Tool.exe is copied to the target folder, not the other files. I tried using This achieves the job, but it has an unfortunate effect that the classes from ToolProject become available in the LibraryProject, which is very misleading and leads to conflicts. The question: is it possible to reference the ToolProject so that it will be used as a dependency from the project point of view (compile order, copying to the output, etc.), but will not be visible in the LibraryProject's source code? |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 2 comments 13 replies
-
This isn't very easy right now. The main tracking bug isdotnet/runtime#53834. |
BetaWas this translation helpful?Give feedback.
All reactions
-
@JanKrivanek This seems pretty close. With |
BetaWas this translation helpful?Give feedback.
All reactions
-
@vladd - If I understand you correctly - you are interested only in copying the build outputs, without exposing the reference public surface to other project(s) in the build - is that correct? There is no short-cut reference metadata support for those requirements. You'd need to write a custom target yourself (that copies the content of the OutputPath after build to the directory of interest). But perhaps theArtifacts output layout might help you achieve what you are looking for? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Exactly, this is my goal.
Well, this is perhaps going to be tricky, as I would need to specify the build order dependency somehow, right? |
BetaWas this translation helpful?Give feedback.
All reactions
-
You should still be able to use the But please try to first have a look onArtifacts output layout to see if it can help you achive your goal. |
BetaWas this translation helpful?Give feedback.
All reactions
-
See, that's the thing..., in most Plug-in or tools based project structure, we don't need the reference but want the build order and the copying of dependencies. I struggled with this problem quite a lot and IMHO, setting |
BetaWas this translation helpful?Give feedback.
All reactions
-
This isn't possible with After that, MSBuild/VisualStudio will always build in the expected order without referencing the tool project. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Unfortunately, build order seems to be not enough, because I need the project output to be copied to the referencing project’s output folder. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Build order ensures that the dependencies will always be built first and then you can gather the build outputs and copy them manually into the referencing project. Just like here:CommunityToolkit/dotnet#220 See the |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Well, it's not that easy, since the referencing project may be a library as well, so we need it to be a transitive dependency for copying. Sorry for being unclear in my previous answer. |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
The customary
My need is to remove the first bullet while keeping the second (because the tool will be started by the referencing library as a process). (I need the referenced project to be a separate tool, because it has different bitness.) |
BetaWas this translation helpful?Give feedback.
All reactions
-
Exactly what I was trying to solve in my own projects. I don't want to reference the files in Code but want them in output/publish directory. In my own projects, I never went beyond 2 levels of transitive references, so, I can't confidently say that this might work beyond that but it's a starting point. You can look at thebinlog to see where and how the transitive references flow and then hook these targets at appropriate places and add the transitive Items either in |
BetaWas this translation helpful?Give feedback.