├── Enums ├── FDAP.cs ├── HRESULT.cs ├── FDE_OVERWRITE_RESPONSE.cs ├── FDE_SHAREVIOLATION_RESPONSE.cs ├── SIATTRIBFLAGS.cs ├── SIGDN.cs └── FOS.cs ├── Pickers.csproj ├── Structures ├── PROPERTYKEY.cs └── COMDLG_FILTERSPEC.cs ├── Guids ├── KFIDGuid.cs ├── CLSIDGuid.cs └── IIDGuid.cs ├── Classes ├── FileOpenDialogRCW.cs ├── FileSaveDialogRCW.cs └── Helper.cs ├── Interfaces ├── IModalWindow.cs ├── FileOpenDialog.cs ├── FileSaveDialog.cs ├── IShellItem.cs ├── IShellItemArray.cs ├── IFileOpenDialog.cs ├── IFileDialogEvents.cs └── IFileDialog.cs ├── FolderPicker.cs ├── FileOpenPicker.cs ├── LICENSE ├── Pickers.sln ├── FileSavePicker.cs ├── README.md ├── .gitattributes └── .gitignore /Enums/FDAP.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Enums; 2 | 3 | // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fdap 4 | internal enum FDAP 5 | { 6 | FDAP_BOTTOM = 0x00000000, 7 | FDAP_TOP = 0x00000001, 8 | } 9 | -------------------------------------------------------------------------------- /Enums/HRESULT.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Enums; 2 | 3 | internal enum HRESULT : long 4 | { 5 | S_FALSE = 0x0001, 6 | S_OK = 0x0000, 7 | E_INVALIDARG = 0x80070057, 8 | E_OUTOFMEMORY = 0x8007000E, 9 | ERROR_CANCELLED = 0x800704C7 10 | } 11 | -------------------------------------------------------------------------------- /Pickers.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Structures/PROPERTYKEY.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Pickers.Structures; 5 | 6 | [StructLayout(LayoutKind.Sequential, Pack = 4)] 7 | internal struct PROPERTYKEY 8 | { 9 | public Guid fmtid; 10 | public uint pid; 11 | } 12 | -------------------------------------------------------------------------------- /Enums/FDE_OVERWRITE_RESPONSE.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Enums; 2 | 3 | // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_overwrite_response 4 | internal enum FDE_OVERWRITE_RESPONSE 5 | { 6 | FDEOR_DEFAULT = 0x00000000, 7 | FDEOR_ACCEPT = 0x00000001, 8 | FDEOR_REFUSE = 0x00000002 9 | } 10 | -------------------------------------------------------------------------------- /Enums/FDE_SHAREVIOLATION_RESPONSE.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Enums; 2 | 3 | // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-fde_shareviolation_response 4 | internal enum FDE_SHAREVIOLATION_RESPONSE 5 | { 6 | FDESVR_DEFAULT = 0x00000000, 7 | FDESVR_ACCEPT = 0x00000001, 8 | FDESVR_REFUSE = 0x00000002 9 | } 10 | -------------------------------------------------------------------------------- /Guids/KFIDGuid.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Guids; 2 | 3 | internal static class KFIDGuid 4 | { 5 | public const string ComputerFolder = "0AC0837C-BBF8-452A-850D-79D08E667CA7"; 6 | public const string Favorites = "1777F761-68AD-4D8A-87BD-30B759FA33DD"; 7 | public const string Documents = "FDD39AD0-238F-46AF-ADB4-6C85480369C7"; 8 | public const string Profile = "5E6C858F-0E22-4760-9AFE-EA3317B67173"; 9 | } 10 | -------------------------------------------------------------------------------- /Classes/FileOpenDialogRCW.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Pickers.Guids; 3 | 4 | namespace Pickers.Classes; 5 | 6 | // --------------------------------------------------- 7 | // .NET classes representing runtime callable wrappers 8 | [ComImport, 9 | ClassInterface(ClassInterfaceType.None), 10 | TypeLibType(TypeLibTypeFlags.FCanCreate), 11 | Guid(CLSIDGuid.FileOpenDialog)] 12 | internal class FileOpenDialogRCW 13 | { 14 | } -------------------------------------------------------------------------------- /Guids/CLSIDGuid.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Guids; 2 | 3 | internal static class CLSIDGuid 4 | { 5 | public const string FileOpenDialog = "DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7"; 6 | public const string FileSaveDialog = "C0B4E2F3-BA21-4773-8DBA-335EC946EB8B"; 7 | public const string KnownFolderManager = "4df0c730-df9d-4ae3-9153-aa6b82e9795a"; 8 | public const string ProgressDialog = "F8383852-FCD3-11d1-A6B9-006097DF5BD4"; 9 | } 10 | -------------------------------------------------------------------------------- /Classes/FileSaveDialogRCW.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Pickers.Guids; 3 | 4 | namespace Pickers.Classes; 5 | 6 | // --------------------------------------------------- 7 | // .NET classes representing runtime callable wrappers 8 | [ComImport, 9 | ClassInterface(ClassInterfaceType.None), 10 | TypeLibType(TypeLibTypeFlags.FCanCreate), 11 | Guid(CLSIDGuid.FileSaveDialog)] 12 | internal class FileSaveDialogRCW 13 | { 14 | } 15 | -------------------------------------------------------------------------------- /Enums/SIATTRIBFLAGS.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Enums; 2 | 3 | // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellitemarray-getattributes 4 | internal enum SIATTRIBFLAGS 5 | { 6 | SIATTRIBFLAGS_AND = 0x00000001, // if multiple items and the attirbutes together. 7 | SIATTRIBFLAGS_OR = 0x00000002, // if multiple items or the attributes together. 8 | SIATTRIBFLAGS_APPCOMPAT = 0x00000003, // Call GetAttributes directly on the ShellFolder for multiple attributes 9 | } 10 | -------------------------------------------------------------------------------- /Interfaces/IModalWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Pickers.Guids; 5 | 6 | namespace Pickers.Interfaces; 7 | 8 | [ComImport(), 9 | Guid(IIDGuid.IModalWindow), 10 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 11 | internal interface IModalWindow 12 | { 13 | 14 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), 15 | PreserveSig] 16 | int Show([In] IntPtr parent); 17 | } 18 | -------------------------------------------------------------------------------- /Interfaces/FileOpenDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Pickers.Classes; 3 | using Pickers.Guids; 4 | 5 | namespace Pickers.Interfaces; 6 | 7 | // --------------------------------------------------------- 8 | // Coclass interfaces - designed to "look like" the object 9 | // in the API, so that the 'new' operator can be used in a 10 | // straightforward way. Behind the scenes, the C# compiler 11 | // morphs all 'new CoClass()' calls to 'new CoClassWrapper()' 12 | [ComImport, 13 | Guid(IIDGuid.IFileOpenDialog), 14 | CoClass(typeof(FileOpenDialogRCW))] 15 | internal interface FileOpenDialog : IFileOpenDialog 16 | { 17 | } -------------------------------------------------------------------------------- /Interfaces/FileSaveDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Pickers.Classes; 3 | using Pickers.Guids; 4 | 5 | namespace Pickers.Interfaces; 6 | 7 | // --------------------------------------------------------- 8 | // Coclass interfaces - designed to "look like" the object 9 | // in the API, so that the 'new' operator can be used in a 10 | // straightforward way. Behind the scenes, the C# compiler 11 | // morphs all 'new CoClass()' calls to 'new CoClassWrapper()' 12 | [ComImport, 13 | Guid(IIDGuid.IFileSaveDialog), 14 | CoClass(typeof(FileSaveDialogRCW))] 15 | internal interface FileSaveDialog : IFileSaveDialog 16 | { 17 | } 18 | -------------------------------------------------------------------------------- /Structures/COMDLG_FILTERSPEC.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Pickers.Structures; 4 | 5 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)] 6 | internal struct COMDLG_FILTERSPEC 7 | { 8 | internal COMDLG_FILTERSPEC(string spec) 9 | { 10 | pszName = spec; 11 | pszSpec = spec; 12 | } 13 | 14 | internal COMDLG_FILTERSPEC(string name, string spec) 15 | { 16 | pszName = name; 17 | pszSpec = spec; 18 | } 19 | 20 | [MarshalAs(UnmanagedType.LPWStr)] 21 | public string pszName; 22 | [MarshalAs(UnmanagedType.LPWStr)] 23 | public string pszSpec; 24 | } 25 | -------------------------------------------------------------------------------- /Enums/SIGDN.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Enums; 2 | 3 | // https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-sigdn 4 | internal enum SIGDN : uint 5 | { 6 | SIGDN_NORMALDISPLAY = 0x00000000, // SHGDN_NORMAL 7 | SIGDN_PARENTRELATIVEPARSING = 0x80018001, // SHGDN_INFOLDER | SHGDN_FORPARSING 8 | SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000, // SHGDN_FORPARSING 9 | SIGDN_PARENTRELATIVEEDITING = 0x80031001, // SHGDN_INFOLDER | SHGDN_FOREDITING 10 | SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000, // SHGDN_FORPARSING | SHGDN_FORADDRESSBAR 11 | SIGDN_FILESYSPATH = 0x80058000, // SHGDN_FORPARSING 12 | SIGDN_URL = 0x80068000, // SHGDN_FORPARSING 13 | SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8007c001, // SHGDN_INFOLDER | SHGDN_FORPARSING | SHGDN_FORADDRESSBAR 14 | SIGDN_PARENTRELATIVE = 0x80080001 // SHGDN_INFOLDER 15 | } 16 | -------------------------------------------------------------------------------- /FolderPicker.cs: -------------------------------------------------------------------------------- 1 | using Pickers.Classes; 2 | using Pickers.Enums; 3 | using System; 4 | 5 | namespace Pickers; 6 | 7 | /// 8 | /// Class responsible for folder pick dialog. 9 | /// 10 | public class FolderPicker 11 | { 12 | /// 13 | /// Window handle where dialog should appear. 14 | /// 15 | private readonly IntPtr _windowHandle; 16 | 17 | /// 18 | /// Folder pick dialog. 19 | /// 20 | /// Window handle where dialog should appear. 21 | public FolderPicker(IntPtr windowHandle) 22 | { 23 | _windowHandle = windowHandle; 24 | } 25 | 26 | /// 27 | /// Shows folder pick dialog. 28 | /// 29 | /// Path to selected folder or empty string. 30 | public string Show() 31 | { 32 | return Helper.ShowOpen(_windowHandle, FOS.FOS_PICKFOLDERS | FOS.FOS_FORCEFILESYSTEM); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /FileOpenPicker.cs: -------------------------------------------------------------------------------- 1 | using Pickers.Classes; 2 | using Pickers.Enums; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Pickers; 7 | 8 | /// 9 | /// Class responsible for open file pick dialog. 10 | /// 11 | public class FileOpenPicker 12 | { 13 | /// 14 | /// Window handle where dialog should appear. 15 | /// 16 | private readonly IntPtr _windowHandle; 17 | 18 | /// 19 | /// Open File pick dialog. 20 | /// 21 | /// Window handle where dialog should appear. 22 | public FileOpenPicker(IntPtr windowHandle) 23 | { 24 | _windowHandle = windowHandle; 25 | } 26 | 27 | /// 28 | /// Shows open file pick dialog. 29 | /// 30 | /// List of extensions applied on dialog. 31 | /// Path to selected file or empty string. 32 | public string Show(List? typeFilters = null) 33 | { 34 | return Helper.ShowOpen(_windowHandle, FOS.FOS_FORCEFILESYSTEM, typeFilters); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 PavlikBender 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Enums/FOS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pickers.Enums; 4 | 5 | [Flags] 6 | // https://learn.microsoft.com/ru-ru/windows/win32/api/shobjidl_core/ne-shobjidl_core-_fileopendialogoptions 7 | internal enum FOS : uint 8 | { 9 | FOS_OVERWRITEPROMPT = 0x00000002, 10 | FOS_STRICTFILETYPES = 0x00000004, 11 | FOS_NOCHANGEDIR = 0x00000008, 12 | FOS_PICKFOLDERS = 0x00000020, 13 | FOS_FORCEFILESYSTEM = 0x00000040, // Ensure that items returned are filesystem items. 14 | FOS_ALLNONSTORAGEITEMS = 0x00000080, // Allow choosing items that have no storage. 15 | FOS_NOVALIDATE = 0x00000100, 16 | FOS_ALLOWMULTISELECT = 0x00000200, 17 | FOS_PATHMUSTEXIST = 0x00000800, 18 | FOS_FILEMUSTEXIST = 0x00001000, 19 | FOS_CREATEPROMPT = 0x00002000, 20 | FOS_SHAREAWARE = 0x00004000, 21 | FOS_NOREADONLYRETURN = 0x00008000, 22 | FOS_NOTESTFILECREATE = 0x00010000, 23 | FOS_HIDEMRUPLACES = 0x00020000, 24 | FOS_HIDEPINNEDPLACES = 0x00040000, 25 | FOS_NODEREFERENCELINKS = 0x00100000, 26 | FOS_DONTADDTORECENT = 0x02000000, 27 | FOS_FORCESHOWHIDDEN = 0x10000000, 28 | FOS_DEFAULTNOMINIMODE = 0x20000000 29 | } 30 | -------------------------------------------------------------------------------- /Pickers.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34616.47 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pickers", "Pickers.csproj", "{17E476B3-6A61-4BB4-9E06-A70DF922BC39}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {17E476B3-6A61-4BB4-9E06-A70DF922BC39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {17E476B3-6A61-4BB4-9E06-A70DF922BC39}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {17E476B3-6A61-4BB4-9E06-A70DF922BC39}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {17E476B3-6A61-4BB4-9E06-A70DF922BC39}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {40BEB263-6CB3-4275-B604-5367DEEBBFDA} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Guids/IIDGuid.cs: -------------------------------------------------------------------------------- 1 | namespace Pickers.Guids; 2 | 3 | internal static class IIDGuid 4 | { 5 | public const string IModalWindow = "b4db1657-70d7-485e-8e3e-6fcb5a5c1802"; 6 | public const string IFileDialog = "42f85136-db7e-439c-85f1-e4075d135fc8"; 7 | public const string IFileOpenDialog = "d57c7288-d4ad-4768-be02-9d969532d960"; 8 | public const string IFileSaveDialog = "84bccd23-5fde-4cdb-aea4-af64b83d78ab"; 9 | public const string IFileDialogEvents = "973510DB-7D7F-452B-8975-74A85828D354"; 10 | public const string IFileDialogControlEvents = "36116642-D713-4b97-9B83-7484A9D00433"; 11 | public const string IFileDialogCustomize = "e6fdd21a-163f-4975-9c8c-a69f1ba37034"; 12 | public const string IShellItem = "43826D1E-E718-42EE-BC55-A1E261C37BFE"; 13 | public const string IShellItemArray = "B63EA76D-1F85-456F-A19C-48159EFA858B"; 14 | public const string IKnownFolder = "38521333-6A87-46A7-AE10-0F16706816C3"; 15 | public const string IKnownFolderManager = "44BEAAEC-24F4-4E90-B3F0-23D258FBB146"; 16 | public const string IPropertyStore = "886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"; 17 | public const string IProgressDialog = "EBBC7C04-315E-11d2-B62F-006097DF5BD4"; 18 | } 19 | -------------------------------------------------------------------------------- /FileSavePicker.cs: -------------------------------------------------------------------------------- 1 | using Pickers.Classes; 2 | using Pickers.Enums; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace Pickers; 7 | 8 | /// 9 | /// Class responsible for save file pick dialog. 10 | /// 11 | public class FileSavePicker 12 | { 13 | /// 14 | /// Window handle where dialog should appear. 15 | /// 16 | private readonly IntPtr _windowHandle; 17 | 18 | /// 19 | /// File save pick dialog. 20 | /// 21 | /// Window handle where dialog should appear. 22 | public FileSavePicker(IntPtr windowHandle) 23 | { 24 | _windowHandle = windowHandle; 25 | } 26 | 27 | /// 28 | /// Shows save file pick dialog. 29 | /// 30 | /// List of extensions applied on dialog. 31 | /// Default name for the file. 32 | /// Path to selected file or empty string. 33 | public string Show(List? typeFilters = null, string defaultName = "") 34 | { 35 | return Helper.ShowSave(_windowHandle, FOS.FOS_FORCEFILESYSTEM, typeFilters, defaultName); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Interfaces/IShellItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Pickers.Enums; 5 | using Pickers.Guids; 6 | 7 | namespace Pickers.Interfaces; 8 | 9 | [ComImport, 10 | Guid(IIDGuid.IShellItem), 11 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 12 | internal interface IShellItem 13 | { 14 | // Not supported: IBindCtx 15 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 16 | void BindToHandler([In, MarshalAs(UnmanagedType.Interface)] IntPtr pbc, [In] ref Guid bhid, [In] ref Guid riid, out IntPtr ppv); 17 | 18 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 19 | void GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); 20 | 21 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 22 | void GetDisplayName([In] SIGDN sigdnName, [MarshalAs(UnmanagedType.LPWStr)] out string ppszName); 23 | 24 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 25 | void GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs); 26 | 27 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 28 | void Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, [In] uint hint, out int piOrder); 29 | } 30 | -------------------------------------------------------------------------------- /Interfaces/IShellItemArray.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Pickers.Enums; 5 | using Pickers.Guids; 6 | using Pickers.Structures; 7 | 8 | namespace Pickers.Interfaces; 9 | 10 | [ComImport, 11 | Guid(IIDGuid.IShellItemArray), 12 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 13 | internal interface IShellItemArray 14 | { 15 | // Not supported: IBindCtx 16 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 17 | void BindToHandler([In, MarshalAs(UnmanagedType.Interface)] IntPtr pbc, [In] ref Guid rbhid, [In] ref Guid riid, out IntPtr ppvOut); 18 | 19 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 20 | void GetPropertyStore([In] int Flags, [In] ref Guid riid, out IntPtr ppv); 21 | 22 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 23 | void GetPropertyDescriptionList([In] ref PROPERTYKEY keyType, [In] ref Guid riid, out IntPtr ppv); 24 | 25 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 26 | void GetAttributes([In] SIATTRIBFLAGS dwAttribFlags, [In] uint sfgaoMask, out uint psfgaoAttribs); 27 | 28 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 29 | void GetCount(out uint pdwNumItems); 30 | 31 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 32 | void GetItemAt([In] uint dwIndex, [MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); 33 | 34 | // Not supported: IEnumShellItems (will use GetCount and GetItemAt instead) 35 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 36 | void EnumItems([MarshalAs(UnmanagedType.Interface)] out IntPtr ppenumShellItems); 37 | } 38 | -------------------------------------------------------------------------------- /Interfaces/IFileOpenDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.InteropServices; 3 | using Pickers.Guids; 4 | using Pickers.Structures; 5 | 6 | namespace Pickers.Interfaces; 7 | 8 | [ComImport(), 9 | Guid(IIDGuid.IFileOpenDialog), 10 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 11 | internal interface IFileOpenDialog : IFileDialog 12 | { 13 | // Defined on IFileDialog - repeated here due to requirements of COM interop layer 14 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 15 | void SetFileTypes([In] uint cFileTypes, [In] ref COMDLG_FILTERSPEC rgFilterSpec); 16 | 17 | // Defined by IFileOpenDialog 18 | // --------------------------------------------------------------------------------- 19 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 20 | void GetResults([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppenum); 21 | 22 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 23 | void GetSelectedItems([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppsai); 24 | } 25 | 26 | internal interface IFileSaveDialog : IFileDialog 27 | { 28 | // Defined on IFileDialog - repeated here due to requirements of COM interop layer 29 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 30 | void SetFileTypes([In] uint cFileTypes, [In] ref COMDLG_FILTERSPEC rgFilterSpec); 31 | 32 | // Defined by IFileOpenDialog 33 | // --------------------------------------------------------------------------------- 34 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 35 | void GetResults([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppenum); 36 | 37 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 38 | void GetSelectedItems([MarshalAs(UnmanagedType.Interface)] out IShellItemArray ppsai); 39 | } 40 | -------------------------------------------------------------------------------- /Interfaces/IFileDialogEvents.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.InteropServices; 3 | using Pickers.Enums; 4 | using Pickers.Guids; 5 | 6 | namespace Pickers.Interfaces; 7 | 8 | [ComImport, 9 | Guid(IIDGuid.IFileDialogEvents), 10 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 11 | internal interface IFileDialogEvents 12 | { 13 | // NOTE: some of these callbacks are cancelable - returning S_FALSE means that 14 | // the dialog should not proceed (e.g. with closing, changing folder); to 15 | // support this, we need to use the PreserveSig attribute to enable us to return 16 | // the proper HRESULT 17 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), 18 | PreserveSig] 19 | HRESULT OnFileOk([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); 20 | 21 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), 22 | PreserveSig] 23 | HRESULT OnFolderChanging([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd, [In, MarshalAs(UnmanagedType.Interface)] IShellItem psiFolder); 24 | 25 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 26 | void OnFolderChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); 27 | 28 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 29 | void OnSelectionChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); 30 | 31 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 32 | void OnShareViolation([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd, [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, out FDE_SHAREVIOLATION_RESPONSE pResponse); 33 | 34 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 35 | void OnTypeChange([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd); 36 | 37 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 38 | void OnOverwrite([In, MarshalAs(UnmanagedType.Interface)] IFileDialog pfd, [In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, out FDE_OVERWRITE_RESPONSE pResponse); 39 | } 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pickers 2 | WinUI 3 (WindowsAppSDK) FileOpenPicker doesn't work for app that runs under Administrator privileges. 3 | 4 | [Trying to use a FileOpenPicker while running the app as Administrator will crash the app](https://github.com/microsoft/WindowsAppSDK/issues/2504) 5 | 6 | In that thread mr. @castorix said: 7 | >I found old links... but they cutted the code :-( 8 | I will try to re-post, but you can find various implementations by typing for example in Google "IFileOpenDialog comimport github" 9 | 10 | I found several good implementations: 11 | 1. [HedgeModManager](https://github.com/thesupersonic16/HedgeModManager/blob/0f2695f0e12f12ada9f8764827d9fc1370b0307f/HedgeModManager/UI/MainWindow.xaml.cs#L1465) 12 | 2. [ShellFileDialogs](https://github.com/daiplusplus/ShellFileDialogs) 13 | 14 | This project is IFileOpenDialog interpretation of [HedgeModManager](https://github.com/thesupersonic16/HedgeModManager/blob/0f2695f0e12f12ada9f8764827d9fc1370b0307f/HedgeModManager/ShellProvider.cs) solution. I made File pick dialog and folder pick dialog. 15 | 16 | ## How to use 17 | Add project to your solution and set dependencies. 18 | 19 | ### Open file pick dialog 20 | 21 | ```csharp 22 | using Pickers; 23 | ... 24 | 25 | // Set filters. 26 | var filters = new List { "*.mp3", "*.wav" }; 27 | // Window handle 28 | var _handle = Process.GetCurrentProcess().MainWindowHandle; 29 | // Create dialog. 30 | var openPicker = new FileOpenPicker(_handle); 31 | // Show dialog. 32 | var file = openPicker.Show(filters); 33 | // Result example: C:\Users\SomeUser\Documents\HelloWorld.mp3 or string.Empty. 34 | ``` 35 | 36 | ### Save file pick dialog 37 | 38 | ```csharp 39 | using Pickers; 40 | ... 41 | 42 | // Set filters. 43 | var filters = new List { "*.mp3", "*.wav" }; 44 | // Set default file name 45 | var defaultName = "song.mp3" 46 | // Window handle 47 | var _handle = Process.GetCurrentProcess().MainWindowHandle; 48 | // Create dialog. 49 | var openPicker = new FileSavePicker(_handle); 50 | // Show dialog. 51 | var file = openPicker.Show(filters, defaultName); 52 | // Result example: C:\Users\SomeUser\Documents\HelloWorld.mp3 or string.Empty. 53 | ``` 54 | 55 | 56 | ### Folder pick dialog 57 | ```csharp 58 | using Pickers; 59 | ... 60 | 61 | // Window handle 62 | var _handle = Process.GetCurrentProcess().MainWindowHandle; 63 | // Create dialog. 64 | var openPicker = new FolderPicker(_handle); 65 | // Show dialog. 66 | var path = openPicker.Show(); 67 | // Result example: C:\Users\SomeUser\Documents or string.Empty. 68 | ``` 69 | 70 | ### Requirements 71 | 1. .NET 7 or higher. 72 | 2. Windows only. 73 | 74 | Tested in WinUI 3 app (WindowsAppSDK 1.4.240211001) on Windows 11 23H2. 75 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Classes/Helper.cs: -------------------------------------------------------------------------------- 1 | using Pickers.Enums; 2 | using Pickers.Interfaces; 3 | using Pickers.Structures; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.InteropServices; 7 | 8 | namespace Pickers.Classes; 9 | 10 | internal static class Helper 11 | { 12 | /// 13 | /// Shows FileOpenDialog. 14 | /// 15 | /// Window handle where dialog should appear. 16 | /// File open dialog options. 17 | /// List of extensions applied on dialog. 18 | /// Path to selected file, folder or empty string. 19 | internal static string ShowOpen(nint windowHandle, FOS fos, List? typeFilters = null) 20 | { 21 | var dialog = new FileOpenDialog(); 22 | try 23 | { 24 | dialog.SetOptions(fos); 25 | 26 | if (typeFilters != null) 27 | { 28 | typeFilters.Insert(0, string.Join("; ", typeFilters)); 29 | var filterSpecs = typeFilters.Select(f => new COMDLG_FILTERSPEC(f)).ToArray(); 30 | 31 | dialog.SetFileTypes((uint)filterSpecs.Length, filterSpecs); 32 | } 33 | 34 | if (dialog.Show(windowHandle) != 0) 35 | return string.Empty; 36 | 37 | dialog.GetResult(out var item); 38 | item.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out var path); 39 | return path; 40 | } 41 | finally 42 | { 43 | #pragma warning disable CA1416 44 | Marshal.ReleaseComObject(dialog); 45 | #pragma warning restore CA1416 46 | } 47 | } 48 | 49 | internal static string ShowSave(nint windowHandle, FOS fos, List? typeFilters = null, string name = "") 50 | { 51 | var dialog = new FileSaveDialog(); 52 | try 53 | { 54 | dialog.SetOptions(fos); 55 | 56 | if (typeFilters != null) 57 | { 58 | var filterSpecs = typeFilters.Select(f => new COMDLG_FILTERSPEC(f)).ToArray(); 59 | 60 | dialog.SetFileTypes((uint)filterSpecs.Length, filterSpecs); 61 | } 62 | 63 | if (!string.IsNullOrEmpty(name)) 64 | dialog.SetFileName(name); 65 | 66 | if (dialog.Show(windowHandle) != 0) 67 | return string.Empty; 68 | 69 | dialog.GetResult(out var item); 70 | item.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out var path); 71 | return path; 72 | } 73 | finally 74 | { 75 | #pragma warning disable CA1416 76 | Marshal.ReleaseComObject(dialog); 77 | #pragma warning restore CA1416 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Interfaces/IFileDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Pickers.Enums; 5 | using Pickers.Guids; 6 | using Pickers.Structures; 7 | 8 | namespace Pickers.Interfaces; 9 | 10 | [ComImport(), 11 | Guid(IIDGuid.IFileDialog), 12 | InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 13 | internal interface IFileDialog : IModalWindow 14 | { 15 | // Defined on IModalWindow - repeated here due to requirements of COM interop layer 16 | // -------------------------------------------------------------------------------- 17 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), 18 | PreserveSig] 19 | int Show([In] IntPtr parent); 20 | 21 | // IFileDialog-Specific interface members 22 | // -------------------------------------------------------------------------------- 23 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 24 | void SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.LPArray)] COMDLG_FILTERSPEC[] rgFilterSpec); 25 | 26 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 27 | void SetFileTypeIndex([In] uint iFileType); 28 | 29 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 30 | void GetFileTypeIndex(out uint piFileType); 31 | 32 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 33 | void Advise([In, MarshalAs(UnmanagedType.Interface)] IFileDialogEvents pfde, out uint pdwCookie); 34 | 35 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 36 | void Unadvise([In] uint dwCookie); 37 | 38 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 39 | void SetOptions([In] FOS fos); 40 | 41 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 42 | void GetOptions(out FOS pfos); 43 | 44 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 45 | void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); 46 | 47 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 48 | void SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi); 49 | 50 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 51 | void GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); 52 | 53 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 54 | void GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); 55 | 56 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 57 | void SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName); 58 | 59 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 60 | void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName); 61 | 62 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 63 | void SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle); 64 | 65 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 66 | void SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText); 67 | 68 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 69 | void SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel); 70 | 71 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 72 | void GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi); 73 | 74 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 75 | void AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, FDAP fdap); 76 | 77 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 78 | void SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)] string pszDefaultExtension); 79 | 80 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 81 | void Close([MarshalAs(UnmanagedType.Error)] int hr); 82 | 83 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 84 | void SetClientGuid([In] ref Guid guid); 85 | 86 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 87 | void ClearClientData(); 88 | 89 | // Not supported: IShellItemFilter is not defined, converting to IntPtr 90 | [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 91 | void SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter); 92 | } 93 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd --------------------------------------------------------------------------------