-
Notifications
You must be signed in to change notification settings - Fork 12.8k
MSBuild integration with ASP.NET Core #60538
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
Comments
Just adding a related issue with the So yeah, this is a critical issue. Hopefully it can get escalated, yeah? It's preventing developers from updating to the latest visual studio/.net sdk. |
@JeroMiya This works on .net 8: |
We experienced this issue while attempting to migrate to |
Adding these two workarounds is not enough for me as I get the following error in a blazor webassembly standalone app: I fixed this error by setting Edit: Sometimes my .js output files were deleted during rebuild. |
After much fiddling, in my .Net8 Blazor Web App project, I found I needed to add <Target Name="FixTypescriptCompileDependencies" BeforeTargets="BeforeBuild">
<PropertyGroup>
<PrepareForBuildDependsOn>
FindConfigFiles;
CompileTypeScript;
CompileTypeScriptWithTSConfig;
GetTypeScriptOutputForPublishing;
$(PrepareForBuildDependsOn)
</PrepareForBuildDependsOn>
</PropertyGroup>
</Target>
<Target Name="RemoveDuplicateTypeScriptOutputs" AfterTargets="GetTypeScriptOutputForPublishing">
<Message Importance="High" Text="GeneratedJavaScript files are: @(GeneratedJavaScript)" />
<ItemGroup>
<Content Remove="@(GeneratedJavaScript)" />
</ItemGroup>
</Target> |
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: