You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ASP.NET SDK has an asset pipeline that processes all the web content for the app to apply optimizations (compression/fingerprinting, etc.).
There are a few things that make integration between the MSBuild SDK and the ASP.NET Core pipeline challenging, and while we've given people guidance, it would be great if we can enable this scenario to work without having to make such changes to their project.
There are two main challenges that we face:
By default the TypeScript targets run too late in the pipeline for us to see the generated outputs. Our guidance suggests hooking up the relevant targets to the PrepareForBuild target as shown below:
I suspect the snippet above is not fully correct, as more targets are involved in the TypeScript setup in CompileDependsOn.
This makes the TS targets run early enough so that standard targets in the ASP.NET Core pipeline can detect and process them as expected.
The second challenge that we face is that is typical for people to dump their outputs into the wwwroot folder. When this happens, (after the change above) GetTypeScriptOutputForPublishing will add all the GeneratedJavaScript items to the Content item group unconditionally.
This results in the presence of duplicate Content items that interferes with the build.
We've given people the following target to remove the duplicates before the GetTypeScriptOutputForPublishing target adds them.
This gets things into a working state, but it's obviously not trivial for customers to discover/setup in their app. Hopefully we can work together to make this scenario just work by implementing a few simple changes.
Have a target ResolveTypeScriptOutputs or similar that produces the compile outputs as items in the Content item group and that can run early enough in the pipeline (PrepareForBuild is a good candidate, or it can be configurable).
Avoid adding duplicate content items to the Content item group by using Exclude="@(Content) to prevent duplicates.
Checking for UsingMicrosoftNETSdkStaticWebAssets to wire up ResolveTypeScriptOutputs early enough in the pipeline so that the outputs can be detected and disable other targets that are not needed (Anything that deals with copying the outputs to the output/publish folder is already handled by the static web assets SDK).
The text was updated successfully, but these errors were encountered:
The ASP.NET SDK has an asset pipeline that processes all the web content for the app to apply optimizations (compression/fingerprinting, etc.).
There are a few things that make integration between the MSBuild SDK and the ASP.NET Core pipeline challenging, and while we've given people guidance, it would be great if we can enable this scenario to work without having to make such changes to their project.
There are two main challenges that we face:
PrepareForBuild
target as shown below:CompileDependsOn
.GetTypeScriptOutputForPublishing
will add all theGeneratedJavaScript
items to theContent
item group unconditionally.Content
items that interferes with the build.GetTypeScriptOutputForPublishing
target adds them.This gets things into a working state, but it's obviously not trivial for customers to discover/setup in their app. Hopefully we can work together to make this scenario
just work
by implementing a few simple changes.ResolveTypeScriptOutputs
or similar that produces the compile outputs as items in theContent
item group and that can run early enough in the pipeline (PrepareForBuild is a good candidate, or it can be configurable).Content
item group by usingExclude="@(Content)
to prevent duplicates.UsingMicrosoftNETSdkStaticWebAssets
to wire upResolveTypeScriptOutputs
early enough in the pipeline so that the outputs can be detected and disable other targets that are not needed (Anything that deals with copying the outputs to the output/publish folder is already handled by the static web assets SDK).The text was updated successfully, but these errors were encountered: