Skip to content

Commit 7ed8ac9

Browse files
authored
Update Setting Up a New Project documentation
1 parent 8090d9d commit 7ed8ac9

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

documentation/development-docs/azure-powershell-developer-guide.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,25 +156,45 @@ When adding a new project, please follow these guidelines:
156156

157157
Add a new folder under `src` with your service specific name (_e.g.,_ `Compute`, `Sql`, `Websites`).
158158

159-
We recommend copying an existing module. For example, go to `src/Media` and copy the contents of this folder. Paste these to your service folder you just created. **Rename** the following:
160-
- The folders to `Commands.<SERVICE>` and `Commands.<SERVICE>.Test`
159+
We recommend copying an existing module. For example, go to `src/Cdn` and copy the contents of this folder. Paste these to your service folder you just created. **Rename** the following:
160+
- The folders to `<SERVICE>` and `<SERVICE>.Test`
161161
- The solution to `<SERVICE>.sln`
162-
- The projects (within each folder) to `Commands.<SERVICE>.csproj` and `Commands.<SERVICE>.Test.csproj`
163-
- The PSD1 file (in the `Commands.<SERVICE>` folder) to `Az.<SERVICE>.psd1`
162+
- The projects (within each folder) to `<SERVICE>.csproj` and `<SERVICE>.Test.csproj`
163+
- The PSD1 file (in the `<SERVICE>` folder) to `Az.<SERVICE>.psd1`
164164

165165
Now, you'll need to edit the solution file. Open the `<SERVICE>.sln` in your text editor of choice. Edit these lines to use your `<SERVICE>` name:
166-
- Update the `"Commands.<SERVICE>.Netcore", "Commands.<SERVICE>\Commands.<SERVICE>.Netcore.csproj"`
167-
- Update the `"Commands.<SERVICE>.Test.Netcore", "Commands.<SERVICE>.Test\Commands.Media.Test.Netcore.csproj"`
168-
169-
After the solution file is updated, save and close it. Now, open the solution file in Visual Studio. Right click on the `Commands.<SERVICE>` project in the `Solution Explorer` and select `Unload project`. Right click on the unloaded project and select `Edit Commands.<SERVICE>.csproj`. Once opened, ensure that the following things are changed:
170-
- The `AssemblyNamespace` and `RootNamespace` attributes of the project _must_ be changed to `Microsoft.Azure.PowerShell.Cmdlets.<SERVICE>`. If these changes are not made, then the assembly produced from this project is not be signed and results in errors when users try to use your module.
171-
- Change the particular `<ItemGroup>` containing `<None Include="Az.<SERVICE>.psd1">`
166+
- Update the `"<SERVICE>", "<SERVICE>\<SERVICE>.csproj"`
167+
- Update the `"<SERVICE>.Test", "<SERVICE>.Test\<SERVICE>.Test.csproj"`
168+
- **Note**: Leave the `"Accounts", "..\Accounts\Accounts\Accounts.csproj"` entry as is. All modules depend on `Accounts`.
169+
170+
After the solution file is updated, save and close it. Now, open the solution file in Visual Studio. Right click on the `<SERVICE>` project in the `Solution Explorer` and select `Unload project`. Right click on the unloaded project and select `Edit <SERVICE>.csproj`. Once opened, ensure that the following things are changed:
171+
- Update this entry to use your service name (what you used as `<SERVICE>` above):
172+
```xml
173+
<PropertyGroup>
174+
<PsModuleName>Cdn</PsModuleName>
175+
</PropertyGroup>
176+
```
177+
- Remove the entry:
178+
```xml
179+
<PropertyGroup>
180+
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)</RootNamespace>
181+
</PropertyGroup>
182+
```
183+
This is not needed since this is a new project.
184+
185+
- Update this entry to use your SDK:
186+
```xml
187+
<ItemGroup>
188+
<PackageReference Include="Microsoft.Azure.Management.Cdn" Version="4.0.2-preview" />
189+
</ItemGroup>
190+
```
191+
If you have not generated your AutoRest SDK yet, remove this entry for now.
172192

173193
Right click on the project and select `Reload project`, and then build the solution by either right clicking on the solution and selecting `Rebuild Solution` or, from the top of Visual Studio, selecting `Build > Rebuild Solution`. If the build does not succeed, open the `.csproj` file and ensure there are no errors.
174194

175195
### Adding Project References
176196

177-
There are a few existing projects that need to be added before developing any cmdlets. To add a project to the solution, right click on the solution in `Solution Explorer` and select `Add > Existing Project`. This allows you to navigate through folders to find the `.csproj` of the project you want to add. Once a project is added to your solution, you can add it as a reference to the `Commands.<SERVICE>` project by right clicking on `Commands.<SERVICE>` and selecting `Add > Reference`. This opens the `Reference Manager` window, and once you have selected the `Projects > Solution` option on the left side of the window, you are able to select which projects you want to reference in `Commands.<SERVICE>` by checking the box to the left of the name.
197+
There are a few existing projects that need to be added before developing any cmdlets. To add a project to the solution, right click on the solution in `Solution Explorer` and select `Add > Existing Project`. This allows you to navigate through folders to find the `.csproj` of the project you want to add. Once a project is added to your solution, you can add it as a reference to the `<SERVICE>` project by right clicking on `<SERVICE>` and selecting `Add > Reference`. This opens the `Reference Manager` window, and once you have selected the `Projects > Solution` option on the left side of the window, you are able to select which projects you want to reference in `<SERVICE>` by checking the box to the left of the name.
178198

179199
# Creating Cmdlets
180200

0 commit comments

Comments
 (0)