Skip to content
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

[BUG] Different output directories on default/production and publish/build #100

Closed
gnuechtel opened this issue Sep 14, 2021 · 10 comments
Closed
Assignees
Labels
bug Something isn't working outdated scope: core

Comments

@gnuechtel
Copy link

The output directories are different on default configuration (debug)/production configuration (release) and @nx-dotnet/core:publish/@nx-dotnet/core:build in workspace.json.

Steps to reproduce the behavior 1:

  1. Create a new Nx workspace
  2. Generate a new .NET application with npx nx generate @nx-dotnet/core:app my-app --template console --language C# --test-template none
  3. Run npx nx build my-app -> Build is stored in <project-root>\dist\apps\my-app
  4. Open workspace.json
  5. Add "output": "dist/apps/anything-else" to configurations -> productions like this:
        "configurations": {
          "production": {
            "output": "dist/apps/anything-else",
            "configuration": "Release"
          }
        }

If that configuration is used, the output is (incorrectly) stored under: <project-root>/apps/my-app/dist/apps/anything-else
6. Change the output value under production to ../../dist/apps/anything-else
7. Run npx nx build my-app --prod --skip-nx-cache -> the output is stored under <project-root>/dist/apps/anything-else. In my opinion the change of step 6 is just a work-around and should not be necessary. Instead the behavior should be consistent to the default (debug) configuration.

Steps to reproduce the behavior 2:

  1. Undo step 6 of behavior 1
  2. Change builder under myapp -> architect -> build from @nx-dotnet/core:publish to @nx-dotnet/core:build,
  3. Run npx nx build my-app --prod --skip-nx-cache -> the output is (correctly) stored under <project-root>/dist/apps/anything-else

Expected behavior

The output path should be configured the same way on build/publish and debug/release

@gnuechtel gnuechtel added bug Something isn't working needs-triage This issue has yet to be looked over by a core team member labels Sep 14, 2021
@AgentEnder
Copy link
Member

Hey @cgnuechte. Good catch! This is because we recently moved to executing the dotnet commands from project root instead of workspace root. I'll try to get a fix for this soon, but in the meantime you should be able to specify this path as a relative path as you mentioned.

@AgentEnder AgentEnder added needs-triage This issue has yet to be looked over by a core team member scope: core and removed needs-triage This issue has yet to be looked over by a core team member labels Sep 14, 2021
@AgentEnder
Copy link
Member

If youre interested, this could be an easy PR, just in the publish / build executors you can use nodes path.relative method to calculate the path relative to the project source before passing it to the dotnet client.

@AgentEnder
Copy link
Member

Let me know if you are interested and I'll assign it to you, it will be about a week or so.

@gnuechtel
Copy link
Author

Hi @AgentEnder Yes, that sounds great :-) I was always interested how to write a Nx plugin.

@AgentEnder
Copy link
Member

@cgnuechtel Actually, now that I'm looking at this I cannot reproduce it... Do you have a repro I can look at?

Are you on mac / linux or windows?

@AgentEnder AgentEnder added blocked-needs-repro This issue needs reproduction steps and removed needs-triage This issue has yet to be looked over by a core team member labels Sep 15, 2021
@AgentEnder
Copy link
Member

Never mind, I ended up figuring out what was going on. I had already updated this to use path.resolve beforehand, but did then was updating the wrong object so it was not getting passed correctly. This will be fixed in the next patch version, didn't mean to take control but it was just relocating a line 😄.

@AgentEnder AgentEnder assigned AgentEnder and unassigned gnuechtel Sep 15, 2021
github-actions bot pushed a commit that referenced this issue Sep 15, 2021
## [1.4.1](v1.4.0...v1.4.1) (2021-09-15)

### Bug Fixes

* **core:** npm prepare script may be removed ([b8e88fa](b8e88fa)), closes [#101](#101)
* **core:** publish output config should be relative to workspace root ([30a7a26](30a7a26)), closes [#100](#100)

Sep 15, 2021, 5:53 PM
@AgentEnder AgentEnder removed the blocked-needs-repro This issue needs reproduction steps label Sep 15, 2021
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 1.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gnuechtel
Copy link
Author

@AgentEnder Fine! Even better :-) Thanks for solving this!

@AgentEnder
Copy link
Member

This was the relevant commit, if you wanted to see what change was needed: 30a7a26

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working outdated scope: core
Projects
None yet
Development

No branches or pull requests

2 participants