Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,5 @@ MigrationBackup/

.DS_Store

LocalFeed/
/.idea/.idea.UnoCheck/.idea
52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

# dotnet-uno-check
# Uno.Check
[![NuGet](https://badgen.net/nuget/v/Uno.Check)](https://www.nuget.org/packages/Uno.Check)

Uno Check tool
**Uno.Check** is a cross-platform, command-line .NET tool that validates and configures your development environment in a single step.
Once installed as a global tool, it runs a series of “checkups”, reports any missing or misconfigured components, and can apply automatic fixes.
Designed to simplify setup and ensures you have everything you need to build and debug Uno apps with confidence.

---

Based on Redth's .NET MAUI Check tool: https://github.com/Redth/dotnet-maui-check

---

To install the tool:
```
Expand All @@ -28,3 +26,45 @@ uno-check
![uno-check running](https://github.com/unoplatform/uno/raw/master/doc/articles/Assets/uno-check-running.gif)

Visit our [documentation](doc/using-uno-check.md) for more details.

## Contributing

Thanks for helping improve Uno.Check — your contributions make a difference! ❤️

### Clone the repository

```bash
git clone https://github.com/unoplatform/uno.check.git
cd uno.check
```

### Run your IDE as Administrator

Uno.Check requires **Administrator** permissions to run so make sure to run your IDE elevated.

### Configure launchSettings.json

If you need to pass custom arguments update [launchSettings.json](https://github.com/unoplatform/uno.check/blob/main/UnoCheck/Properties/launchSettings.json) profiles accordingly.


### Build & install a local version

We include a helper script to pack and install your locally built `uno.check` as a global tool, so you can test changes immediately on your machine:

```powershell
# From the repo root:
./pack-and-install.ps1
```


### Spectre.Console

This CLI is built on [Spectre.Console](https://spectreconsole.net/) — feel free to explore their docs for examples.



---

Based on [Redth's .NET MAUI Check tool](https://github.com/Redth/dotnet-maui-check).

---
97 changes: 97 additions & 0 deletions install_locally.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<#
.SYNOPSIS
Pack a .NET solution (or current folder), generate a LocalOnly.NuGet.Config
inside the feed directory (so it won't affect the solution), and install
(or reinstall) the Uno.Check global tool from that feed.

.PARAMETER Solution
Optional path to a .sln file or project folder.
If omitted or empty, `dotnet pack` will run on the current directory.

.PARAMETER LocalFeed
Optional directory to emit nupkg files into.
If omitted or empty, defaults to `LocalFeed` in the script folder.

.EXAMPLE
Packs the solution from the current directory and places all nupkg files in ./LocalFeed
Removes any installed Uno.Check versions and installs locally-built version instead.
./pack-and-install.ps1

.EXAMPLE
# Packs path/to/MySolution.sln into ./MyFeed folder.
Removes any installed Uno.Check versions and installs locally-built version instead.
./pack-and-install.ps1 path/to/MySolution.sln MyFeed
#>

[CmdletBinding()]
param(
[Parameter(Position = 0)]
[string]$Solution = "",

[Parameter(Position = 1)]
[string]$LocalFeed = ""
)

# Fail on any error
$ErrorActionPreference = 'Stop'

$PackageId = 'Uno.Check'

# Determine script directory and set defaults
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Push-Location $scriptDir

if (-not $Solution) {
Write-Host "No solution specified → packing current directory"
$packTarget = "."
} else {
$packTarget = $Solution
}

if (-not $LocalFeed) {
$LocalFeed = "LocalFeed"
Write-Host "No feed directory specified → using default '$LocalFeed'"
}

# Ensure feed directory exists
if (-not (Test-Path $LocalFeed)) {
Write-Host "Creating feed directory: $LocalFeed"
New-Item -ItemType Directory -Path $LocalFeed | Out-Null
}

Write-Host "Packing '$packTarget' to '$LocalFeed'..."
dotnet pack $packTarget -c Release -o $LocalFeed

# Place NuGet.Config inside the feed directory
$configFile = Join-Path $LocalFeed 'LocalOnly.NuGet.Config'
$feedUri = (Resolve-Path -Path $LocalFeed).ProviderPath.TrimEnd('\','/')

Write-Host "Generating NuGet.Config at '$configFile'..."
@"
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- only your local folder -->
<add key="LocalFeed" value="$feedUri" />
</packageSources>
</configuration>
"@ | Out-File -FilePath $configFile -Encoding utf8

# If Uno.Check is already installed, uninstall it first
$installed = dotnet tool list --global | Select-String -Pattern "^\s*$PackageId\s"
if ($installed) {
Write-Host "Detected existing installation of '$PackageId'. Uninstalling..."
dotnet tool uninstall --global $PackageId
}

Write-Host "Installing tool '$PackageId' using only '$configFile'..."
dotnet tool install --global $PackageId `
--configfile $configFile `
--ignore-failed-sources

Write-Host "`nDone. '$PackageId' is installed from your local feed."
Pop-Location

# Prevent the script window from closing immediately
Write-Host "`nPress Enter to exit..."
Read-Host | Out-Null
Loading