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

[Preview 8] Typescript generated js file in wwwroot in RCL not included #13122

Closed
MarkStega opened this issue Aug 14, 2019 · 6 comments
Closed
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Docs This issue tracks updating documentation

Comments

@MarkStega
Copy link

MarkStega commented Aug 14, 2019

If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.

Describe the bug

Typescript generated js file in wwwroot in Razor Class Library not included as content.

To Reproduce

Steps to reproduce the behavior:

  1. Using ASP.NET Core 3.0P8/VS2019 16.3.0P2
  2. See Build order issue with RCL static assets and TSC generated JS files in wwwroot #12646 that was closed but without a resolution
  3. Same error as described

Expected behavior

Expect JS that was generated by TSC to be included as a static asset without having to manually create a target for the generated file.

@mkArtakMSFT mkArtakMSFT added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Docs This issue tracks updating documentation labels Aug 14, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview9 milestone Aug 14, 2019
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @MarkStega.
We'll cover this through docs.

@MarkStega
Copy link
Author

In the meantime, what is the "magic sauce" needed to force the inclusion of generated wwwroot\js files as content?

@SQL-MisterMagoo
Copy link
Contributor

@mkArtakMSFT I have a github repo here https://github.com/SQL-MisterMagoo/BlazorPreview_8_Typescript_Sample - where the Typescript file is correctly compiled to a JS file and is included as a static web asset.

The JS content is served up correctly in the Server-side blazor project, but only if the ASPNETCORE_ENVIRONMENT is set to Development. If you change that environment setting, the asset is no longer served.

This means you cannot publish the Server-Side Blazor project and expect static web assets to work.

The repo contains one Client-Side project, one Server-Side project and a component library - all produced using the templates from preview 8.

The RCL project also has EmbeddedResources because that is the only way to get the static web assets to work in Client-Side currently.

Hopefully this helps with reproducing the problems.

@mkArtakMSFT
Copy link
Member

Thanks for the info, @SQL-MisterMagoo.
@javiercn do you have any recommendation here? Would be great to put it here, if it's quick, before you get to the docs.
If not very simple, that's ok - do it when you get to this.

For context to others, this is scheduled to be handled during preview 9, so not much left for this to be handled.

@javiercn
Copy link
Member

You need to add TypeScriptCompile as a dependency for resolving the static web assets for the current project so that the typescript build happens before we compute the list of static web assets for the current project.

    <ResolveCurrentProjectStaticWebAssetsInputsDependsOn>
      TypeScriptCompile;
      $(ResolveCurrentProjectStaticWebAssetsInputsDependsOn)
    </ResolveCurrentProjectStaticWebAssetsInputsDependsOn>

You might also need to remove any unwanted output to prevent them from being included as content or contentFiles in the package. You can do so by adding your own custom target.

This will work in preview9 and onwards.

@javiercn
Copy link
Member

Filed an issue to track the addition to the docs. dotnet/AspNetCore.Docs#13969

Closing this one as there's no further action to be taken here.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Docs This issue tracks updating documentation
Projects
None yet
Development

No branches or pull requests

4 participants