C
C#8mo ago
kacperz

I can't find ASP.NET Core with React.js

Hello guys, I want to create ASP.NET Core with React.js because I want to follow Tutorial but in visual studio on my computer I can't find it. Should I install additional module? May somebody help me with that?(the first screenshot is from tutorial)
No description
No description
35 Replies
leowest
leowest8mo ago
No description
leowest
leowest8mo ago
that's the only one I see I wonder if there is missing templates
kacperz
kacperzOP8mo ago
I have it too but are they the same? Why haven't I template from the tutorial is it because of visual studio version?
No description
leowest
leowest8mo ago
what version of visual studio are u using? I suspect they were replace but im not sure
kacperz
kacperzOP8mo ago
It's Visual Studio Community 2022 v17.10.0
No description
leowest
leowest8mo ago
]
No description
leowest
leowest8mo ago
yeah I guess they replaced it and the new template sets everything up
kacperz
kacperzOP8mo ago
ok thank you but I have another issue when I am trying to compile this application this errors occure everytime
No description
leowest
leowest8mo ago
and if u do it from the console?
kacperz
kacperzOP8mo ago
how can i do that?
leowest
leowest8mo ago
u go to the folder where the csproj is and do dotnet build
kacperz
kacperzOP8mo ago
No description
kacperz
kacperzOP8mo ago
it's the same issue
leowest
leowest8mo ago
open the vs installer
No description
leowest
leowest8mo ago
and go to modify and check nodejs
leowest
leowest8mo ago
No description
kacperz
kacperzOP8mo ago
i have it downloaded
No description
leowest
leowest8mo ago
then on the previous window do a repair on visual studio
kacperz
kacperzOP8mo ago
ok this may take a few minutes
leowest
leowest8mo ago
aside from that everything works for me
kacperz
kacperzOP8mo ago
I repaired this but it stil doesn't work
No description
leowest
leowest8mo ago
it would have helped if the errors were in English and not as a image, I dont do web front end so this is as far as I can help u sorry. Maybe someone else can assist u
kacperz
kacperzOP8mo ago
ok thank you
Keswiik
Keswiik8mo ago
What version of nodejs are you using?
friedice
friedice8mo ago
what version of .net do you have installed?
Jimmacle
Jimmacle8mo ago
.NET 8 doesn't have templates that include SPAs just set up the SPA separately
kacperz
kacperzOP8mo ago
No description
kacperz
kacperzOP8mo ago
.net 8.0 how can i do it?
Jimmacle
Jimmacle8mo ago
follow the instructions for setting one up with vite/etc vite can proxy requests to your API project in development and for production you can serve the frontend files directly from the API
Keswiik
Keswiik8mo ago
do you need vite? As long as you set up the SPA stuff properly in your Startup it should be able to run fine
Jimmacle
Jimmacle8mo ago
what SPA stuff are you referring to? i haven't done this much myself but vite does stuff like HMR for hot reloading when you change the frontend source
Keswiik
Keswiik8mo ago
app.UseSpa(spa => {
spa.Options.SourcePath = "ClientApp";

if (env.IsDevelopment()) {
spa.UseReactDevelopmentServer(npmScript: "start");
}
});
app.UseSpa(spa => {
spa.Options.SourcePath = "ClientApp";

if (env.IsDevelopment()) {
spa.UseReactDevelopmentServer(npmScript: "start");
}
});
Jimmacle
Jimmacle8mo ago
and what if you aren't using react :when:
Keswiik
Keswiik8mo ago
well this guy was trying to use react lol only reason I mentioned it
Jimmacle
Jimmacle8mo ago
i'm guessing that's specifically for CRA which to my understanding is hot garbage vite is a similar tool
Want results from more Discord servers?
Add your server