rkttu
8월 19, 2025, 2:59오전
3
Program.cs
#!/usr/bin/env dotnet
#:sdk Microsoft.NET.Sdk.WebAssembly
#:property OverrideHtmlAssetPlaceholders=true
#:property AllowUnsafeBlocks=true
#:property PublishAot=false
// dotnet run Program.cs
using System.Diagnostics;
using System.Runtime.InteropServices.JavaScript;
This file has been truncated. show original
wwwroot-index.html
<!DOCTYPE html>
<!-- Licensed to the .NET Foundation under one or more agreements. -->
<!-- The .NET Foundation licenses this file to you under the MIT license. -->
<html>
<head>
<title>simpleweb2</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preload" id="webassembly" />
This file has been truncated. show original
wwwroot-main.js
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
import { dotnet } from './_framework/dotnet.js'
const { setModuleImports, getAssemblyExports, getConfig, runMain } = await dotnet
.withApplicationArguments("start")
.create();
setModuleImports('main.js', {
This file has been truncated. show original
File-based App 프로젝트로도 쓸 수 있나 해서 테스트해봤는데, VS Code에서 약간 튀는 부분을 제외하면 개발 경험도 괜찮고 잘 쓸 수 있네요! wwwroot 폴더에 js와 html 파일을 cs 파일과 같은 위치에 넣어주기만 해도 dotnet run 명령으로 정적 콘텐츠 인식도 잘 되고 잘 뜨는 것 같습니다.
10개의 좋아요