Replies: 4 comments 4 replies
-
We had considered using I am curious how these MSBuild files could allow test files co-located with production files. In my Angular projects, I love the way the tests aren't far from the system-under-test, but I didn't know it could be done with .NET. Can you provide more detail on how that can be done, and what trade-offs might be involved? As for standardizing all build output in the |
Beta Was this translation helpful? Give feedback.
-
Hey @tzuge! I know we briefly chatted about this in the past, and I had been meaning to follow up on it, but it had been incredibly building. I'd love to help this merger happen. New contributors are always welcome, and new users mean more testing and better results overall. Regarding the three concerns directly mentioned here, I'll detail the current background and paths I'd be willing/happy to embrace. Shared DependenciesWe currently handle this via the Same-directory / Inline testsThis is still something that I think is cool and wouldn't be a bad idea so long as the built artifacts were not affected too much. Even if they are, putting it behind a flag would be welcome. See my comments from our original discussion linked above.
Dist folder outputWe currently handle a few things in nx-dotnet via XML manipulation on the individual project files. This isn't the prettiest, but working with these files is something we have to do for project references as well. I'd personally be welcome to ripping out the .csproj manipulation entirely and even for reading it just using some of the dotnet commands (e.g. dotnet list). I don't think we could easily get rid of all of it, but it's undoubtedly one of the messier areas in the codebase and could use a second pass. One of the two things that use XML manipulation currently is the output path mapping. This isn't great. A consequence of this is that when writing the move generator, we will have to recalculate this path and update it again (see discussion on #406). The other is adding a prebuild target to the apps that runs a node task using an The output manipulation fits I'd welcome a change that removes the current manipulation stuff and replaces it with creating these two files in the
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response guys. I really appreciate the discussion. In general the challenge I have is that many of the behaviours are already implemented in this library but with different implementation as you guys are highlighting. It doesn't necessarily make sense to introduce an alternative approach with parameters, since why would a user select A or B when end result is more or less identical? So perhaps the right approach is to figure out what's preferred in each case (at least as a default). Somewhat related, the conventions of nx are rather different from the conventions of dotnet development, e.g. sln files. So there will be some awkwardness in reconciling the two. Shared DependenciesI agree the extraneous dependencies in outputs is an issue. There are some equivalents on the javascript side.
dotnet similarly supports both models, and so perhaps we should investigate trimming as the tree shaking equivalent. Same-directory / Inline testsI rather like this convention as well, but it is different from how dotnet unit tests normally work. Normally there is a dedicated unit test project that references the project under test, so all unit test dependencies, test files, and assets are kept out of the main project. Not sure if this has changed, but in the past this meant InternalsVisibleToAttribute was necessary to unit test internal classes, etc. The gist of making this work is that we have conditional inclusion of test references and test files. Currently we use the configuration as the condition, but there's probably a better approach. This means that the assembly created for unit testing is different from an actual deployment assembly. That's not really a good thing, but I believe it is consistent with how jest is configured in nx (i.e. unit tests don't exercise the built bundles). As a related thing, if handling this in the Dist folder outputIf you guys are ok with the inclusion of |
Beta Was this translation helpful? Give feedback.
-
Created issues to track individual portions of this conversation: |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I am looking at reconciling our own dotnet plugin for nx with @nx-dotnet/core. We currently use Directory.Build.props and Directory.Build.target to customize the dotnet project to align to some default nx conventions, e.g. build output to /dist at the repo root, tests/specs next to code (under the same project). As another example, package references could go into Directory.Build.props at the root and be applied to all projects under, which might remove the need for the sync generator.
I'm interested in whether this sort of opinionated setup belongs in this library and how to incorporate it if yes.
Describe the solution you'd like
Clarity on whether we should try to contribute the opinionated workspace configuration and how best to structure it. e.g. parameter on init generator, etc.
Describe alternatives you've considered
We can use @nx-dotnet/core supplemented with our own plugin for the more opinionated templates.
Beta Was this translation helpful? Give feedback.
All reactions