Adding an Uno Platform Project to an existing solution
As of Uno 6.0, the Uno Platform solution templates do not support being included in an existing solution. This known issue can still be worked around by a few manual steps.
In order to add an Uno Platform project to an existing solution:
In a separate temporary folder, create a new project using the Visual Studio 2022 or
dotnet newtemplates, usingMyProjectfor its name.Copy the generated individual project folders to your solution folder (
MyProject,MyProject.Server, etc...)For the
global.jsonfile:If your solution already contains a
global.jsonfile, merge themsbuild-sdkssection:"msbuild-sdks": { "Uno.Sdk": "6.0.146" },If not, copy the entire
global.jsonand place it next to your existing sln.
For the
Directory.Build.Propsfile, Uno Platform templates use NuGet Central Package Management (CPM) by default, which might conflict with your existing solution.If your solution uses CPM, you'll only need to copy the
ImplicitUsingsandNullableproperties in yourMyProject.csprojIf your solution does not use CPM:
- If you want to start using CPM, you can migrate to use it entirely and copy the contents of Uno's
Directory.Packages.propsto your own version of that file. - If you don't want to use CPM, search for each
PackageReferencein each of Uno's projects and add the versions found in Uno'sDirectory.Packages.props, if any, as it depends on the options chosen when creating the projects.
- If you want to start using CPM, you can migrate to use it entirely and copy the contents of Uno's
The other files
.vsconfig,.editorconfigand.gitignoreare completely optional and can be copied to your solution as needed.Finally, manually add the projects to your solution using right-click on the root, click Add, then Existing Project