[Ivy.Docs.Shared]: fix missing markdown embedded resources by correcting MSBuild target timing#4542
Merged
rorychatt merged 1 commit intoMay 30, 2026
Conversation
…ing MSBuild target timing
Collaborator
Staging removedStaging environment has been deleted for this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a critical issue where the "Copy Page" functionality (
.mdraw file fetching) returned a 404 error on the deployeddocs.ivy.appenvironment, despite working perfectly onlocalhost.The Issue
On the production deployment, attempting to fetch any raw markdown file (e.g.,
https://docs.ivy.app/onboarding/getting-started/introduction.md) resulted in a404 Not Foundresponse generated by theMarkdownMiddleware. The middleware correctly intercepted the request butAssembly.GetManifestResourceStream()returnednull, indicating that the embedded.mdresources were missing from the compiledIvy.Docs.Shared.dll.The Root Cause
The root cause was a subtle MSBuild pipeline timing issue introduced during a previous build pipeline simplification (PR #3477).
In
Ivy.Docs.Shared.csproj, theTransformMarkdowntarget was configured as:During a clean Docker build (where the
Generated/directory does not exist because it is.gitignored), MSBuild processes embedded resources (AssignTargetPathsandPrepareResourceNames) beforeCoreCompile. Because theGenerated/folder was empty when MSBuild evaluated the<EmbeddedResource>items, it recorded 0 resources to embed.The
ivy-docs-clitool successfully generated the.mdand.g.csfiles moments later (which is why the C# UI pages worked), but it was too late for the resource pipeline, resulting in an assembly with no embedded markdown files.Locally, this bug was masked because the
Generated/directory persists between builds, allowing MSBuild to find the.mdfiles from previous runs during its initial evaluation phase.The Fix
To fix this, the MSBuild target signature in
Ivy.Docs.Shared.csprojwas updated to explicitly run earlier in the pipeline, immediately after resolving project references (matching the working configuration inIvy.Tendril.Docs.csproj):By adding
AfterTargets="ResolveProjectReferences", we forceTransformMarkdownto execute beforeAssignTargetPaths. This guarantees thativy-docs-cligenerates the markdown files in time for the .NET SDK resource pipeline to detect and embed them into the final.dll, ensuring they are available in production.