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

Automatically copy wwwroot/** to publish directory #4537

Closed
SteveSandersonMS opened this issue Feb 7, 2022 · 4 comments · Fixed by #4782
Closed

Automatically copy wwwroot/** to publish directory #4537

SteveSandersonMS opened this issue Feb 7, 2022 · 4 comments · Fixed by #4782
Assignees
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! proposal/open t/enhancement ☀️ New feature or request

Comments

@SteveSandersonMS
Copy link
Member

Description

https://github.com/aspnet/Tooling-ManualTests/pull/1591#discussion_r799659030

We should consider putting some MSBuild logic in the Blazor Hybrid MAUI, WinForms, and WPF packages that is equivalent to adding the following to your .csproj:

    <ItemGroup>
        <Content Update="wwwroot\**" 
                 CopyToOutputDirectory="PreserveNewest" />
    </ItemGroup>

Otherwise, developer have to clutter their own .csproj with this, and might forget to do so. This would bring things into line with wwwroot being published automatically in the Web SDK.

Public API Changes

Intended Use-Case

@SteveSandersonMS SteveSandersonMS added proposal/open area-blazor Blazor Hybrid / Desktop, BlazorWebView labels Feb 7, 2022
@mkArtakMSFT mkArtakMSFT added t/enhancement ☀️ New feature or request and removed t/enhancement ☀️ New feature or request labels Feb 7, 2022
@Eilon
Copy link
Member

Eilon commented Feb 8, 2022

@SteveSandersonMS if this is more consistent with other SDKs, I'm all for it. How does one change from wwwroot to another folder? Is there a variable? Or you just don't? Difficulty/discoverability of changing from wwwroot was some of the original thinking for not having it in the SDK. For the record, I think that discoverability and difficulty are both far less important than at least somehow being able to do it, because I think that 99.99% of people will use the default wwwroot anyway.

@SteveSandersonMS
Copy link
Member Author

Actually following @javiercn's suggestion, I re-checked this and it turns out that it's not necessary to have this. It must be built into the SDK or package already.

The fact that BlazorWinFormsApp in the MAUI repo still includes this in its csproj is what made me think it was necessary. It seems like it is necessary for the app within the MAUI repo, but is not necessary for a WinForms app I created externally and used the actual packages.

So, I'll close this issue, and will update the CTI steps to remove this bit. As we create the other CTI scenarios for other platforms, we'll be forced to validate in each case that it's not necessary to have anything like this in the csproj.

@SteveSandersonMS
Copy link
Member Author

Apparently this is not functioning currently. I'm not sure why it appeared to work correctly when I tried it, but either I did something wrong or there was a difference in my local environment.

As per this comment: https://github.com/aspnet/Tooling-ManualTests/pull/1591#issuecomment-1040059686 the project on WinForms at least doesn't work unless you explicitly copy wwwroot files to the output directory, so we should reopen this issue and fix it.

@Eilon
Copy link
Member

Eilon commented Feb 15, 2022

@SteveSandersonMS maybe you had the files in the bin folder from a previous build? And they didn't get cleaned up on rebuild because they're not seen as output files anymore? Anyway, weird.

SteveSandersonMS added a commit that referenced this issue Feb 18, 2022
SteveSandersonMS added a commit that referenced this issue Feb 18, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
@mkArtakMSFT mkArtakMSFT added this to the 6.0.300-preview.14 milestone Mar 24, 2022
@samhouts samhouts added the fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! label Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView fixed-in-6.0.200-preview.14.2 Look for this fix in 6.0.200-preview.14.2! proposal/open t/enhancement ☀️ New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants