diff --git a/README.md b/README.md index 35e3baf..3753fd5 100644 --- a/README.md +++ b/README.md @@ -4,36 +4,45 @@ ConsoleControl is a C# class library that lets you embed a console in a WinForms or WPF application. This console can be used for input and output for a process. It's great for making tools and utilities. +![ConsoleControl Screenshot](./docs/screenshot.png "ConsoleControl Screenshot") -![ConsoleControl Screenshot](https://github.com/dwmkerr/consolecontrol/blob/master/Assets/screenshot.png?raw=true "ConsoleControl Screenshot") +## Installing -Installing ConsoleControl -------------------------- - -Installing couldn't be easier, just use Nuget. You can search for 'ConsoleControl' or install directly. +Installing couldn't be easier, just use NuGet. You can search for 'ConsoleControl' or install directly. For WinForms: -```` +``` PM> Install-Package ConsoleControl -```` +``` For WPF: -```` +``` PM> Install-Package ConsoleControl.WPF -```` +``` + +## Using ConsoleControl + +Once you've installed the package, the ConsoleControl will be available in the toolbox. Add a ConsoleControl to your WPF or WinForms project and call `StartProcess` to start a new process. The process will run and all output will be directed to the ConsoleControl. You can also optionally enable input from the control. + +## Developer Guide + +To build, open the main `./source/ConsoleControl.sln` solution to build and run any of the code or samples. + +You can also use the following scripts to run the processes: -Using ConsoleControl --------------------- +| Script | Notes | +|-------------|-------------------------------------------| +| `build.ps1` | Build the solution from the command line. | -Once you've installed the package, the ConsoleControl will be available in the toolbox. Add a ConsoleControl to your WPF or WinForms project and call 'StartProcess' to start a new process. The process will run and all output will be directed to the ConsoleControl. You can also optionally enable input from the control. +You can learn how the ConsoleControl was created by reading the article [Embedding a Console in a C# Application](http://www.codeproject.com/Articles/335909/Embedding-a-Console-in-a-C-Application) article on the CodeProject. -Buidling and Extending the Code -------------------------------- +### Creating a Release -You can learn how the ConsoleControl was created by reading this article on the CodeProject: +To create a release: -http://www.codeproject.com/Articles/335909/Embedding-a-Console-in-a-C-Application +1. Update the version number in [`SharedAssemblyInfo.cs`](./source/SharedAssemblyInfo.cs) +2. Create a new version tag, then push `git push --follow-tags` -Building the code is as straightforward as downloading it and building the project. +AppVeyor will build and publish a new NuGet package and as long as a new semver tag is pushed. diff --git a/appveyor.yml b/appveyor.yml index 5cbb232..e305dc2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,11 +2,6 @@ version: 1.0.{build} image: Visual Studio 2017 configuration: Release -# Before building, restore Nuget packages and install dependencies. -before_build: -- ps: | - nuget restore source\ConsoleControl.sln - build: project: source\ConsoleControl.sln publish_nuget: true @@ -22,6 +17,6 @@ deploy: - provider: GitHub auth_token: secure: KTWUORrnJKPKLSf/3ROLY50T9UfgTMnKHf3OjBOv8tlY/DAxtlglRU3eM+j45fMt - artifact: SharpShell.*.nupkg, ServerRegistrationManager.*.nupkg, ServerManager.zip, ServerRegistrationManager.zip + artifact: SharpShell.*.nupkg, ServerRegistrationManager.*.nupkg on: APPVEYOR_REPO_TAG: true diff --git a/build/BuildRelease.ps1 b/build/BuildRelease.ps1 deleted file mode 100644 index ad96087..0000000 --- a/build/BuildRelease.ps1 +++ /dev/null @@ -1,47 +0,0 @@ -# IMPORTANT: Make sure that the path to msbuild is correct! -$msbuild = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" -if ((Test-Path $msbuild) -eq $false) { - Write-Host "Cannot find msbuild at '$msbuild'." - Break -} - -# Load useful functions. -. .\Resources\PowershellFunctions.ps1 - -# Keep track of the 'build' folder location - it's the root of everything else. -# We can also build paths to the key locations we'll use. -$scriptParentPath = Split-Path -parent $MyInvocation.MyCommand.Definition -$folderReleaseRoot = $scriptParentPath -$folderSourceRoot = Split-Path -parent $folderReleaseRoot -$folderSolutionsRoot = Join-Path $folderSourceRoot "source" -$folderNuspecRoot = Join-Path $folderSourceRoot "build\nuspec" - -# Part 1 - Build the main libraries. -Write-Host "Preparing to build solution..." -$solutionCoreLibraries = Join-Path $folderSolutionsRoot "ConsoleControl.sln" -. $msbuild $solutionCoreLibraries /p:Configuration=Release /verbosity:minimal - -# Part 2 - Get the version number of the core library, use this to build the destination release folder. -$folderWinFormsBinaries = Join-Path $folderSolutionsRoot "ConsoleControl\bin\Release" -$folderWPFBinaries = Join-Path $folderSolutionsRoot "ConsoleControl.WPF\bin\Release" -$releaseVersion = [Reflection.Assembly]::LoadFile((Join-Path $folderWinFormsBinaries "ConsoleControl.dll")).GetName().Version -Write-Host "Built Solution. Release Version: $releaseVersion" - -# Part 3 - Copy the libraries to the nuget package folders. -$folderNugetWinForms = Join-Path $folderNuspecRoot "ConsoleControl\lib\net40" -$folderNugetWPF= Join-Path $folderNuspecRoot "ConsoleControl.WPF\lib\net40" -Remove-Item -Force -Recurse $folderNugetWinForms -Remove-Item -Force -Recurse $folderNugetWPF -CopyItems (Join-Path $folderWinFormsBinaries "*.*") $folderNugetWinForms -CopyItems (Join-Path $folderWPFBinaries "*.*") $folderNugetWPF - -# Part 4 - Build the Nuget Package -$folderRelease = Join-Path $folderReleaseRoot $releaseVersion -EnsureEmptyFolderExists($folderRelease) -Write-Host "Preparing to build the Nuget Package..." -$nuget = Join-Path $scriptParentPath "Resources\nuget.exe" -. $nuget pack (Join-Path $folderNuspecRoot "ConsoleControl\ConsoleControl.nuspec") -Version $releaseVersion -OutputDirectory $folderRelease -. $nuget pack (Join-Path $folderNuspecRoot "ConsoleControl.WPF\ConsoleControl.WPF.nuspec") -Version $releaseVersion -OutputDirectory $folderRelease - -# We're done! -Write-Host "Successfully built version: $releaseVersion" \ No newline at end of file diff --git a/build/Resources/PowershellFunctions.ps1 b/build/Resources/PowershellFunctions.ps1 deleted file mode 100644 index 3a2094c..0000000 --- a/build/Resources/PowershellFunctions.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -# Copy items to a destination folder, creating the folder if needed. -function CopyItems($source, $destinationFolder) { - - # Create the any folders or subfolders up to the destination that don't exist. - EnsureFolderExists($destinationFolder) - - # Now copy the items. - Copy-Item $source -Destination $destinationFolder -} - -# Ensures that a folder exists. -function EnsureFolderExists($folder) { - - # Create the any folders or subfolders up to the destination that don't exist. - if (!(Test-Path -path $folder)) { - New-Item $folder -Type Directory - } -} - -# Ensures that a folder exists and deletes anything in it. -function EnsureEmptyFolderExists($folder) { - EnsureFolderExists($folder) - Remove-Item -Recurse -Force $folder - EnsureFolderExists($folder) -} \ No newline at end of file diff --git a/build/Resources/nuget.exe b/build/Resources/nuget.exe deleted file mode 100644 index 9cba6ed..0000000 Binary files a/build/Resources/nuget.exe and /dev/null differ diff --git a/Assets/screenshot.png b/docs/screenshot.png similarity index 100% rename from Assets/screenshot.png rename to docs/screenshot.png diff --git a/source/ConsoleControl.WPF/ConsoleControl.WPF.csproj b/source/ConsoleControl.WPF/ConsoleControl.WPF.csproj index 6acabdc..da98273 100644 --- a/source/ConsoleControl.WPF/ConsoleControl.WPF.csproj +++ b/source/ConsoleControl.WPF/ConsoleControl.WPF.csproj @@ -88,6 +88,7 @@ Resources.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/build/nuspec/ConsoleControl.WPF/ConsoleControl.WPF.nuspec b/source/ConsoleControl.WPF/ConsoleControl.WPF.nuspec similarity index 59% rename from build/nuspec/ConsoleControl.WPF/ConsoleControl.WPF.nuspec rename to source/ConsoleControl.WPF/ConsoleControl.WPF.nuspec index 07f894b..57deb70 100644 --- a/build/nuspec/ConsoleControl.WPF/ConsoleControl.WPF.nuspec +++ b/source/ConsoleControl.WPF/ConsoleControl.WPF.nuspec @@ -1,15 +1,16 @@ - - - - ConsoleControl.WPF - 1.0.3 - ConsoleControl for WPF - Dave Kerr - https://github.com/dwmkerr/consolecontrol - https://github.com/dwmkerr/consolecontrol - false - The ConsoleControl is a WPF control that you can drop into a WPF applcation to run an external process in a C# application. - - Dave Kerr 2013-2015 - - \ No newline at end of file + + + + $id$ + $version$ + ConsoleControl for WPF + Dave Kerr + Dave Kerr + https://github.com/dwmkerr/consolecontrol/LICENSE.md + https://github.com/dwmkerr/consolecontrol + false + The ConsoleControl is a WPF control that you can drop into a WPF applcation to run an external process in a C# application. + Copyright © Dave Kerr 2018 + Console,Shell + + diff --git a/source/ConsoleControl/ConsoleControl.csproj b/source/ConsoleControl/ConsoleControl.csproj index 9298501..a1e88e2 100644 --- a/source/ConsoleControl/ConsoleControl.csproj +++ b/source/ConsoleControl/ConsoleControl.csproj @@ -1,136 +1,137 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {737CC7F2-EC7C-4800-B7EB-72637E892C42} - Library - Properties - ConsoleControl - ConsoleControl - v4.0 - 512 - - - - - 3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - Client - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - bin\Release\ConsoleControl.xml - - - true - - - ConsoleControl.snk - - - - - 3.5 - - - - - 3.5 - - - 3.5 - - - - - - - Properties\SharedAssemblyInfo.cs - - - UserControl - - - ConsoleControl.cs - - - - - - - - ConsoleControl.cs - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - - - {a4b8573f-ebfc-4140-b8aa-7c037919ef57} - ConsoleControlAPI - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {737CC7F2-EC7C-4800-B7EB-72637E892C42} + Library + Properties + ConsoleControl + ConsoleControl + v4.0 + 512 + + + + + 3.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + Client + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + bin\Release\ConsoleControl.xml + + + true + + + ConsoleControl.snk + + + + + 3.5 + + + + + 3.5 + + + 3.5 + + + + + + + Properties\SharedAssemblyInfo.cs + + + UserControl + + + ConsoleControl.cs + + + + + + + + ConsoleControl.cs + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + {a4b8573f-ebfc-4140-b8aa-7c037919ef57} + ConsoleControlAPI + + + + + + + + --> \ No newline at end of file diff --git a/build/nuspec/ConsoleControl/ConsoleControl.nuspec b/source/ConsoleControl/ConsoleControl.nuspec similarity index 59% rename from build/nuspec/ConsoleControl/ConsoleControl.nuspec rename to source/ConsoleControl/ConsoleControl.nuspec index cf199b4..0964ca1 100644 --- a/build/nuspec/ConsoleControl/ConsoleControl.nuspec +++ b/source/ConsoleControl/ConsoleControl.nuspec @@ -1,15 +1,16 @@ - - - - ConsoleControl - 1.0.3 - ConsoleControl for WinForms - Dave Kerr - https://github.com/dwmkerr/consolecontrol - https://github.com/dwmkerr/consolecontrol - false - The ConsoleControl is a WinForms control that you can drop into a Form to run an external process in a C# application. - - Dave Kerr 2013-2015 - - \ No newline at end of file + + + + $id$ + $version$ + ConsoleControl for WinForms + Dave Kerr + Dave Kerr + https://github.com/dwmkerr/consolecontrol/LICENSE.md + https://github.com/dwmkerr/consolecontrol + false + The ConsoleControl is a WinForms control that you can drop into a Form to run an external process in a C# application. + Copyright © Dave Kerr 2018 + Console,Shell + + diff --git a/source/build.ps1 b/source/build.ps1 new file mode 100644 index 0000000..be8d763 --- /dev/null +++ b/source/build.ps1 @@ -0,0 +1,7 @@ +# Run msbuild on the solution, in release mode. +$msbuild ="${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" +$args = "ConsoleControl.sln /t:Rebuild /p:Configuration=Release" + +# Run the command. +Write-Host "Running: ""$msbuild"" $args" +& "$msbuild" /p:Configuration=Release /t:Clean,Build ConsoleControl.sln