Loading...
Loading...
Compare original and translation side by side
.csproj.sln.csproj.slndotnet new umbraco-extensionumbraco-backofficedotnet new umbraco-extensionumbraco-backoffice.csprojundefined.csprojundefined
The main Umbraco project will have:
- A `<PackageReference Include="Umbraco.Cms" ...>` entry
- SDK of `Microsoft.NET.Sdk.Web`
- Usually located at the solution root or in a dedicated folder
主Umbraco项目具备以下特征:
- 包含`<PackageReference Include="Umbraco.Cms" ...>`条目
- 使用`Microsoft.NET.Sdk.Web` SDK
- 通常位于解决方案根目录或专用文件夹中.csproj<ProjectReference>.csproj<ProjectReference>.csproj/.csproj| Extension Location | Example Relative Path |
|---|---|
| Sibling folder | |
| Subfolder | |
| Skills folder | |
.csproj/.csproj| 扩展位置 | 示例相对路径 |
|---|---|
| 同级文件夹 | |
| 子文件夹 | |
| Skills文件夹 | |
<ProjectReference><ItemGroup><ItemGroup>
<!-- Existing references -->
<ProjectReference Include="../ExistingExtension/ExistingExtension.csproj" />
<!-- Add new extension here -->
<ProjectReference Include="../NewExtension/NewExtension.csproj" />
</ItemGroup><ItemGroup><ProjectReference><ItemGroup><ItemGroup><ProjectReference><ItemGroup>
<!-- 现有引用 -->
<ProjectReference Include="../ExistingExtension/ExistingExtension.csproj" />
<!-- 在此处添加新扩展 -->
<ProjectReference Include="../NewExtension/NewExtension.csproj" />
</ItemGroup><ProjectReference><ItemGroup><ItemGroup>.slnundefined.slnundefined
**Scenarios to handle:**
| Scenario | Action |
|----------|--------|
| No `.sln` file found | Skip this step - it's not required |
| One `.sln` file found | Add the extension to it |
| Multiple `.sln` files found | Ask the user which solution to use |
| Extension already in solution | `dotnet sln add` will report this - safe to ignore |
**Add the extension project to the solution:**
```bash
dotnet sln <path-to-solution.sln> add <path-to-extension.csproj>undefined
**需处理的场景:**
| 场景 | 操作 |
|----------|--------|
| 未找到`.sln`文件 | 跳过此步骤——这不是必需的 |
| 找到一个`.sln`文件 | 将扩展添加到该解决方案中 |
| 找到多个`.sln`文件 | 询问用户要使用哪个解决方案 |
| 扩展已在解决方案中 | `dotnet sln add`会报告此情况——可安全忽略 |
**将扩展项目添加到解决方案:**
```bash
dotnet sln <path-to-solution.sln> add <path-to-extension.csproj>undefined
When a solution file exists, adding the extension ensures:
- The extension appears in Visual Studio/Rider solution explorer
- Building the solution builds the extension
- IDE features like "Go to Definition" work across projects
当存在解决方案文件时,添加扩展可确保:
- 扩展出现在Visual Studio/Rider的解决方案资源管理器中
- 构建解决方案时会同时构建扩展
- IDE的“转到定义”等功能可跨项目使用<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="16.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../BlankExtension/BlankExtension.csproj" />
</ItemGroup>
</Project><Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="16.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../BlankExtension/BlankExtension.csproj" />
</ItemGroup>
</Project><Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="16.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../BlankExtension/BlankExtension.csproj" />
<ProjectReference Include="../MyNewExtension/MyNewExtension.csproj" />
</ItemGroup>
</Project><Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="16.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../BlankExtension/BlankExtension.csproj" />
<ProjectReference Include="../MyNewExtension/MyNewExtension.csproj" />
</ItemGroup>
</Project>Umbraco.Cms.csproj<ProjectReference>.slndotnet sln adddotnet buildUmbraco.Cms.csproj<ProjectReference>.slndotnet sln adddotnet builddotnet builddotnet rundotnet builddotnet run.csprojcd ExtensionName/Client && npm run buildumbraco-package.jsonwwwroot.csprojUmbraco.CmsMicrosoft.NET.Sdk.WebProgram.csStartup.cs<ProjectReference>.csprojdotnet sln add.csprojcd ExtensionName/Client && npm run buildwwwrootumbraco-package.jsonUmbraco.Cms.csprojMicrosoft.NET.Sdk.WebProgram.csStartup.cs.csproj<ProjectReference>dotnet sln add