一處開發,多處同步編輯使用,并且發布時各個專案均可獨立
一、直接編輯專案工程檔案 .csproj
具體實作為:編輯 .csproj 檔案,在<ItemGroup>中添加新的 <Content /> 或 <Compile /> 節點:
Include: 屬性值為專案檔案的相對參考路徑
Link: 節點中放置要參考到當前專案中的位置
1.無需編譯的靜態資源檔案等,使用 標簽引入
- 參考當前工程內的檔案
<ItemGroup>
<Content Include="Views\_EmailOfficeCancelledEmail.cshtml"/>
</ItemGroup>
- 參考外部專案工程中的檔案
<ItemGroup>
<Content Include="..\MvcDemo\MvcWeb\Views\_EmailOfficeCancelledEmail.cshtml">
<Link>Views\_EmailOfficeCancelledEmail.cshtml</Link>
</Content>
</ItemGroup>
2.需要編譯的cs檔案等,使用 標簽引入
- 參考當前工程內的檔案
<ItemGroup>
<Compile Include="Controllers\CommonController.cs"/>
</ItemGroup>
- 參考外部專案工程中的檔案
<ItemGroup>
<Compile Include="..\..\MvcDemo\MvcWeb\Controllers\CommonController.cs">
<Link>Controllers\HomeController.cs</Link>
</Compile>
</ItemGroup>
3.最終實作的參考效果


二、使用 Visual Studio 軟體可視化操作
1.右鍵添加現有項

2.添加為鏈接

3.最終實作的效果

轉載請註明出處,本文鏈接:https://www.uj5u.com/net/96219.html
標籤:.NET Core
下一篇:c#表單
