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

Fix the reference to the .targets file #13847

Merged
merged 2 commits into from Mar 9, 2023
Merged

Conversation

prjseal
Copy link
Contributor

@prjseal prjseal commented Feb 17, 2023

When you create a new umbraco site and you use the -p switch to reference an Umbraco package, it adds an import for the .targets file from the Umbraco package project.

This .targets file used to be in the build folder but it is now in the buildTransitive folder.

To replicate this, first of all create a new umbracopackage project.

dotnet new umbracopackage -n "MyProject.Package"

Then create a new umbraco project which references the package using the -p switch

# Ensure we have the latest Umbraco templates
dotnet new -i Umbraco.Templates::10.4.0

dotnet new umbraco --force -n "MyProject.Site" --friendly-name "Administrator" --email "admin@example.com" --password "1234567890" --development-database-type SQLite -p "MyProject.Pacakge"

dotnet run --project "MyProject.Site"
#Running

You will get this error

C:\Code\demo\MyProject.Site\MyProject.Site.csproj(29,3): error MSB4019: The imported project "C:\Code\demo\MyProject.Pa
cakge\build\MyProject.Pacakge.targets" was not found. Confirm that the expression in the Import declaration "..\MyProje
ct.Pacakge\build\MyProject.Pacakge.targets" is correct, and that the file exists on disk.

The build failed. Fix the build errors and run again.

With this PR it will update the path for the .targets file to have the folder buildTransitive

Hopefully you have all you need here to be able to replicate the issue and verify the fix

Updates the reference to the .targets file to use the correct folder name of `buildTransitive` instead of `build`
@github-actions
Copy link

github-actions bot commented Feb 17, 2023

Hi there @prjseal, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@emmagarland emmagarland self-assigned this Mar 6, 2023
@emmagarland emmagarland self-requested a review March 6, 2023 13:18
@emmagarland emmagarland merged commit d8f204d into umbraco:contrib Mar 9, 2023
11 of 13 checks passed
@emmagarland
Copy link
Contributor

Hi @prjseal,

Thanks for the detailed replication steps and your pull request. I have verified this issue, and have successfully merged your fix. 🙌

Emma

nul800sebastiaan pushed a commit that referenced this pull request Mar 17, 2023
Updates the reference to the .targets file to use the correct folder name of `buildTransitive` instead of `build`

(cherry picked from commit d8f204d)
@nul800sebastiaan
Copy link
Member

Cherry picked for 10.5 in b8d6613

@nul800sebastiaan
Copy link
Member

I've amended the above cherry pick as it accidentally kept both the old and the new version, instead of just changing the one line. This is now committed on v10/dev (b67c7fb) and should roll through to v11 and higher in the next few days when we do some more merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants