No easy way to change ASPNETCORE_ENVIRONMENT or get UserSecrets with WebApplicationTestFixture #7587
Comments
The secrets are coming out null, and the Config object that's injected into my pages are not the same one I made before. |
I think the proposed fix here is to use the We want to also make sure that it's reasonable to set the environment as well, and add a code sample to the docs. |
@rynowak There's still (I think) an underlying issue...even if I change the Environment, I can't seem to access "WebProject1"'s UserSecrets from "TestProject1." There is something there, unrelated to Environment. |
We are discussing this. Will update shortly. Regarding user secrets, can it be that is looking for the user secrets for your test assembly instead of for your app assembly? I will have to look into it in more detail |
I was thinking that might be the case, but I added the UserSecretsID in the
csproj.
…On Tue, Apr 10, 2018 at 10:36 AM, Javier Calvarro Nelson < ***@***.***> wrote:
We are discussing this. Will update shortly. Regarding user secrets, can
it be that is looking for the user secrets for your test assembly instead
of for your app assembly? I will have to look into it in more detail
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7587 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAALTIj37AFfg2Zhf0Xk9c5bmzAryb4zks5tnO2tgaJpZM4TCrg9>
.
--
Scott Hanselman
Donate to fight diabetes: http://hnsl.mn/fightdiabetes
|
@shanselman Hey Scott, I was able to get the user secrets once I set the environment to development on my test. (I'm using preview2 for the repro). Can you tell me more about how you were setting the environment/ping me to take a look at your app with you? It won't take us long. |
Trying to follow https://blogs.msdn.microsoft.com/webdev/2018/03/05/asp-net-core-2-1-0-preview1-functional-testing-of-mvc-applications/
The defaults are not sensible. I should not have to do this, to just use Development, or use User Secrets:
@davidfowl
The text was updated successfully, but these errors were encountered: