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

No wwwroot created on publish of an ASP.NET with React Project #60652

Closed
1 task done
MichaMican opened this issue Feb 27, 2025 · 12 comments
Closed
1 task done

No wwwroot created on publish of an ASP.NET with React Project #60652

MichaMican opened this issue Feb 27, 2025 · 12 comments
Labels
area-ui-rendering Includes: MVC Views/Pages, Razor Views/Pages External This is an issue in a component not contained in this repository. It is open for tracking purposes. ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@MichaMican
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When using the template ASP.NET with React Project in the past when i built and published the Solution a got binaries that contained a wwwroot folder that conatined the output of the vite build (dist folder). This does not happen anymore - I digged deep into the build logs to compare both solutions and found two interesting things:

1.

On the new Project microsoft.visualstudio.javascript.sdk\1.0.2191419\Sdk\Sdk.targets is used on the old microsoft.visualstudio.javascript.sdk\0.5.271090-alpha\Sdk\Targets\Sdk.WebAssets.targets. They have vastly different outputs so i can't realy compare the operations associated with it. I also don't know where the pin of this version comes from - the Projects are completey the same judging by the sln csproj launschsettings an property fiels in it.

2 .

I realized in the new build output there is a function called _PublishCopyStaticWebAssetsPreserveNewest beeing skipped - which is NOT skipped in the old version.
New Project build:

Target "_PublishCopyStaticWebAssetsPreserveNewest" in file "C:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets" from project "D:\<MYPATHREDACTED>\<NEWPROJECTNAMEREDACTED>\<NEWPROJECTNAMEREDACTED>\<NEWPROJECTNAMEREDACTED>.Server\<NEWPROJECTNAMEREDACTED>.Server.csproj" (target "ComputeAndCopyFilesToPublishDirectory" depends on it):
        Skipping target "_PublishCopyStaticWebAssetsPreserveNewest" because it has no outputs.
        Though the target has declared its outputs, the output specification only references empty properties and/or empty item lists.
        Done building target "_PublishCopyStaticWebAssetsPreserveNewest" in project "<NEWPROJECTNAMEREDACTED>.Server.csproj".

Old Project build

Target "_PublishCopyStaticWebAssetsPreserveNewest" in file "C:\Program Files\dotnet\sdk\9.0.200\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets" from project "D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\<OLDPROJECTNAMEREDACTED>.Server.csproj" (target "ComputeAndCopyFilesToPublishDirectory" depends on it):
        Building target "_PublishCopyStaticWebAssetsPreserveNewest" completely.
        Output file "D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\branding-dark-B-KdMaK2.svg" does not exist.
        Output file "D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\branding-wfC8eXCa.svg" does not exist.
        Output file "D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\index-CCgeGBVi.css" does not exist.
        Output file "D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\index-eAyNrqgY.js" does not exist.
        Output file "D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\favicon.ico" does not exist.
        Output file "D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\index.html" does not exist.
        Task "Copy"
        : Task Parameter:
    DestinationFiles=
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\branding-dark-B-KdMaK2.svg
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\branding-wfC8eXCa.svg
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\index-CCgeGBVi.css
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\assets\index-eAyNrqgY.js
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\favicon.ico
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Server\obj\Release\net8.0\PubTmp\Out\wwwroot\index.html
        : Task Parameter:
    SourceFiles=
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Client\dist\assets\branding-dark-B-KdMaK2.svg
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Client\dist\assets\branding-wfC8eXCa.svg
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Client\dist\assets\index-CCgeGBVi.css
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Client\dist\assets\index-eAyNrqgY.js
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Client\dist\favicon.ico
        D:\<MYPATHREDACTED>\<OLDPROJECTNAMEREDACTED>.Client\dist\index.html
        : Task Parameter:OverwriteReadOnlyFiles=False
<THIS GOES ON FOR QUITE A FEW LINES!!>

Does anyone have an idea what is going on? I assume there must be a bug in either the template or some under the hood dependencies that are used during an dotnet publish I am really desperate and can't find a solution

Expected Behavior

www root folder beeing in the published output so taht when the published output is started it serves the frontend

Steps To Reproduce

Create new project from VS teamplate "React and ASP.NET Core" (TypeScript)
Make a Folder Publish
Inspect the publish folder:
See no wwwroot folder is present.

-> If you start the .exe in that publish folder it also comes up with a warning that it did not find the wwwroot:

Image

Exceptions (if any)

No response

.NET Version

9.0.200

Anything else?

VS

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Feb 27, 2025
@xensik
Copy link

xensik commented Mar 2, 2025

same problem here, changing project sdk to latest nuget version (microsoft.visualstudio.javascript.sdk/1.0.2518757) makes no effect.

edit: last working version for me is microsoft.visualstudio.javascript.sdk/1.0.2125207

@MichaMican
Copy link
Author

@xensik How did you pin that version? I couldn't figure out where this version is of microsoft.visualstudio.javascript.sdk is defined

@MichaelTheLearner
Copy link

Same issue. Is there a workaround?

@xensik
Copy link

xensik commented Mar 6, 2025

@xensik How did you pin that version? I couldn't figure out where this version is of microsoft.visualstudio.javascript.sdk is defined

change the sdk version in the project file to the last working version

Image

@mikekistler mikekistler added area-ui-rendering Includes: MVC Views/Pages, Razor Views/Pages and removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Mar 7, 2025
@danroth27
Copy link
Member

@joj

@MackinnonBuck MackinnonBuck added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label Mar 12, 2025
@mattvarghese
Copy link

Same issue happened to me.
Changed from
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.2191419">
To
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.1738743">

And it fixed it.

@remartens
Copy link

Same issue here. When you create a new React project in Visual Studio 2022, you have to change the Microsoft.VisualStudio.JavaScript.SDK version to 1.0.2125207 to have the wwwroot folder being published.

@cremor
Copy link
Contributor

cremor commented Mar 17, 2025

I have the same problem with an Angular project. I could also fix it by reverting to SDK version 1.0.1738743. (This is a version that a previous VS version set as default for new projects.)

I've also found the same bug report here: https://developercommunity.visualstudio.com/t/MicrosoftVisualStudioJavaScriptSdk-no/10860121

@joj I'd like to repeat something another user posted there:

I too would like to know about a publically available changelog. As far as I can see, this is one of the SDKs that Microsoft has chosen to keep private for some reason. It would be great if they would open-source it and allow us to see the source code, create issues via GitHub etc. From the outside, it seems odd for them to keep this closed-sourced when so much of the modern .NET ecosystem is open and freely viewable. I’d love to know the reason for it.

Related: #56111

@sambetts
Copy link

+1 have the same issue.

I could also fix it by reverting to SDK version 1.0.1738743. (This is a version that a previous VS version set as default for new projects.)

This fixed it nicely.

@DaleMckeown
Copy link

According to my issue on Developer Community (https://developercommunity.visualstudio.com/t/MicrosoftVisualStudioJavaScriptSdk-no/10860121):

A fix for this issue has been internally implemented and is being prepared for release. We’ll update you with the version number once it becomes available for download.

I will provide more information as I get it.

@MackinnonBuck
Copy link
Member

Since this issue is being tracked as a Visual Studio Feedback ticket and relates to a product other than ASP.NET Core, we're going to close this out.

A fix has been merged and will be included in an upcoming Visual Studio release.

@MackinnonBuck MackinnonBuck closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2025
@MackinnonBuck MackinnonBuck added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Mar 19, 2025
@DaleMckeown
Copy link

Confirmed fixed in 1.0.2655793.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ui-rendering Includes: MVC Views/Pages, Razor Views/Pages External This is an issue in a component not contained in this repository. It is open for tracking purposes. ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests