Umbraco-CMS
Umbraco-CMS copied to clipboard
appsettings.Local.json is not copied to output directory when using Umbraco.Cms.Tests.Integration
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
13.*
Bug summary
The Umbraco.Cms.Tests.Integration
nuget package adds a linked appsettings.Local.json
file.
However it must be set to copy to output directory manually for it to "work".
It's also linked to the user specific nuget cache folder, so it would be super if it points to $(NuGetPackageRoot)
instead.
I've looked around the source, but cannot for the life of me figure out how/where the file is included in the package. 🙈
Specifics
No response
Steps to reproduce
Install Umbraco.Cms.Tests.Integration
.
Derive a class from UmbracoIntegrationTest
.
Add a test to it.
See if it runs.
(Also have to inherit GlobalSetupTeardown
and mark it as SetUpFixture
ofc.)
Expected result / actual result
No response
Hi there @lars-erik!
Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.
We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
- We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
- If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
- We'll replicate the issue to ensure that the problem is as described.
- We'll decide whether the behavior is an issue or if the behavior is intended.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.
Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:
Hi @lars-erik , can you describe more details about your expected result? I'm not sure if you're referring to the appsettings.Local.json or appsettings.Tests.json file?
It's about the appsettings.Tests.json file.
In the core integration test project it is "correctly" set up.
https://github.com/umbraco/Umbraco-CMS/blob/e8051978e975deafe57511d8939c003ea2347a94/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj#L54
When the package is installed in a project however, the linked file loses its CopyToOutputDirectory
attribute. It's only linked as content and that makes it so it isn't copied on build and the tests won't run.
We can manually set the attribute back, but then Visual Studio will point to the local user's nuget cache:
<ItemGroup>
<Content Update="C:\Users\[my user name]\.nuget\packages\umbraco.cms.tests.integration\14.2.0\contentFiles\any\net8.0\appsettings.Tests.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
The path can then manually be set to $(NugetPackageRoot)\umbraco.cms.tests.integration\14.2.0\contentFiles\any\net8.0\appsettings.Tests.json
.
Both these steps would be unnecessary if the nuget package could provide the copy to output attribute.
ATM I don't know how to do that, otherwise I'd make a PR.