在同一文件夾中為 .NET 5 和 .NET 6 Preview 3 構建 WebAssembly 項目 (Building WebAssembly project for both .NET 5 and .NET 6 Preview 3 in same folder)


問題描述

在同一文件夾中為 .NET 5 和 .NET 6 Preview 3 構建 WebAssembly 項目 (Building WebAssembly project for both .NET 5 and .NET 6 Preview 3 in same folder)

我有一個使用 GitHub 操作構建的 .NET 5 WebAssembly 項目。這工作沒有任何問題。我想設置我的文件夾,這樣我也可以使用 .NET 6 Preview 3 編譯同一個項目(使用不同的項目文件),這樣我就可以在調試時利用熱重載功能。在 GitHub Actions 支持編譯 .NET 6 項目之前,我必須暫時保留 .NET 5 項目文件。

我有一個可以編譯的 project6.csproj 文件。如果我在同一目錄中創建 project5.csproj 文件並嘗試使用 dotnet build project5.csproj 構建它,我會在 _Imports.razor: error CS0234 中遇到錯誤。

什麼是在同一個文件夾中並排構建 .NET 5 和 .NET 6 項目的推薦方法?


參考解法

方法 1:

I solved it by using the cp command before the dotnet publish command:

cp project5.csprog project.csproj

(by Philipp SchmidPhilipp Schmid)

參考文件

  1. Building WebAssembly project for both .NET 5 and .NET 6 Preview 3 in same folder (CC BY‑SA 2.5/3.0/4.0)

#visual-studio #.net #blazor-webassembly






相關問題

如何在 C# 中使用帶有動態參數的 INSERT INTO SQL 查詢? (How to use a INSERT INTO SQL Query with Dynamic parameters in C#?)

擴展 SSRS 中的圖表功能 (Extending chart functionality in SSRS)

如何將 MVC 5 項目模板添加到 VS 2012? (How can I add the MVC 5 project template to VS 2012?)

Visual Studio - 將按鈕/複選框添加到工具欄以切換只讀文件屬性, (Visual Studio - Add a button/checkbox to a toolbar to switch the readonly file property,)

在 Javascript/Jquery Ajax 調用中使用 WCF 服務 (Consuming WCF service in Javascript/Jquery Ajax call)

Visual Basic 2013 - 控制台輸入令牌? (Visual Basic 2013 - Console Input Tokens?)

您是否知道用於編輯/翻譯資源(.rc)文件的好的程序? (Do you know of a good program for editing/translating resource (.rc) files?)

ADODB.Recordset 數據無法綁定到 datagridview (ADODB.Recordset data cannot bind into datagridview)

Reporting Services - 對數據源視圖 (DSV) 的報表模型 (SDML) 引用 (Reporting Services - Report Model (SDML) reference to Data Source View (DSV))

從 Visual Studio 2005 遷移到 2008 時要注意什麼? (What to look out for when moving from Visual Studio 2005 to 2008?)

動態改變另一個類的標籤值 (Dynamically changing the value of a label from another class)

在同一文件夾中為 .NET 5 和 .NET 6 Preview 3 構建 WebAssembly 項目 (Building WebAssembly project for both .NET 5 and .NET 6 Preview 3 in same folder)







留言討論