You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The folder will contain a tooling and components folder. The latter contains all the individual Toolkit components.
Editing a component
In an existing component folder, you can run OpenSolution.bat to generate the .sln:
cd *path of your component*
.\OpenSolution.bat
The .sln` will open automatically, and contains the source project (component code), samples project (samples and documentation) and tests project (for all tests).
You can test your component code by adding it to a sample, and use the different startup projects to test it on UWP, WinAppSDK or Uno.
Running the sample app
Run the following script to navigate to the cloned folder, install SlnGen and run GenerateAllSolutions.bat.
cd *path of your Toolkit folder*
dotnet tool restore
.\GenerateAllSolution.bat
This will generate and open the CommunityToolkit.AllComponents.sln. In Visual Studio, select the preferred startup project (Uwp (WinUI2), WinAppSDK (WinUI3) or Wasm (Uno).
Creating a new component
To create a new component run the following script:
cd *path of your Toolkit folder*
dotnet new --install .\tooling\ProjectTemplate\
cd components
dotnet new ctk-component -n MyExperimentNameHere
This will generate a new component folder that contains src, samples and tests folders.
FAQ
Errors that might come up when running the .bat files:
Error: Cannot be loaded because running scripts is disabled on this system
Error: Could not find a Visual Studio installation. Please run from a command window that has MSBuild.exe on the PATH or specify the full path to devenv.exe via the -vs command-line argument
Use Developer Command Prompt for VS2022, or add msbuild.exe to your PATH variables to use it in e.g. PowerShell. (More info: https://stackoverflow.com/a/12608705)