Copydotnet.d.ts to wwwroot on build/publish.#120097
Conversation
|
Its also worth pointing that
Which is an output from the |
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs
Outdated
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/AssetsComputingHelper.cs
Outdated
Show resolved
Hide resolved
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmBuildAssets.cs
Outdated
Show resolved
Hide resolved
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmBuildAssets.cs
Outdated
Show resolved
Hide resolved
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
Outdated
Show resolved
Hide resolved
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/Wasm.Build.Tests/BrowserStructures/MSBuildOptions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
Adds an opt-in MSBuild property to copy the generated dotnet.d.ts TypeScript definition file into a WebAssembly project's wwwroot during build, addressing issue #77174.
- Introduces WasmEmitTypeScriptDefinitions property (default false) in relevant .targets.
- Adds MSBuild target _EnsureDotnetTypeScriptDefinitions to perform the conditional copy.
- Adds a test validating the file copy on build (Debug/Release).
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/mono/wasm/build/WasmApp.Common.targets | Documents and defines the new WasmEmitTypeScriptDefinitions property. |
| src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets | Adds property default again and new target to copy dotnet.d.ts into wwwroot. |
| src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs | Adds test ensuring dotnet.d.ts is copied on build when the property is enabled. |
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
|
WBT fail, even though manual run of |
|
@maraf, this one needs more work. While it works when used "manually", WBT fail. I will investigate it when I get time |
WasmEmitTypeScriptDefinitionsMSBuild property (defaultfalse) so projects can request the generateddotnet.d.tstypings._EnsureDotnetTypeScriptDefinitionstarget copiesdotnet.d.tsfrom the runtime pack into the project’swwwrooton build or publish when that property is enabled.TypeScriptDefinitionsCopiedToWwwrootOnBuild) to cover Debug/Release and verify the file is produced only when requested.Fixes #77174.