Silver Black
Silver Black
CC#
Created by Silver Black on 9/11/2024 in #help
How to distribute VisualStyles for dialogs Vista style - FIXED!
Ok, I fixed it. In Publish, I went to "Show all settings" and in the "Profile settings" window I clicked the "File publish option" at the bottom and unticked the "Produce single file" setting. And this did the trick!!! I got a folder with many files, but same overall size, and much smaller executable size, that can be useful in case I should deliver an update of the executable only in future.
15 replies
CC#
Created by Silver Black on 9/11/2024 in #help
How to distribute VisualStyles for dialogs Vista style - FIXED!
What can I also check? As I said, the executable in bin\Debug\net8.0-windows runs without this issue.
15 replies
CC#
Created by Silver Black on 9/11/2024 in #help
How to distribute VisualStyles for dialogs Vista style - FIXED!
@reflectronic Main main method is:
internal static class Program
{
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
internal static class Program
{
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormMain());
}
}
I also have a manifest file called <executable-file-name>.exe.manifest in the same folder of the executable itself: ...\bin\Release\net8.0-windows\publish\self-contained. The error message I receive in the exception is: Value cannot be null. (Parameter 'path1') There is no parmeter "path1" in my code:
public static bool EnMsgBoxYesNo(in string strMsg, in string strDescription = ClsStrings_ITA.STR_DLG_QUESTION, in string strTitle = ClsConstants.STR_PROJ_TITLE)
{
try
{
// Initialization:
Microsoft.WindowsAPICodePack.Dialogs.TaskDialog dialog = new()
{
Caption = strTitle,
InstructionText = strDescription,
Text = strMsg,
StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No,
Icon = TaskDialogStandardIcon.Warning /* non trovo l'icona del punto interrogativo!!! :( */
};
// Show dialog:
TaskDialogResult result = dialog.Show();
// Check user input:
if (result == TaskDialogResult.Yes)
{
return true; // yes
}
else
{
return false; // no
}
}
catch (Exception ex)
{
MsgErrorHandler(ex.Message, ClsStrings_ITA.STR_ERR_MSGBOX_INFO); // ERROR: Value cannot be null. (Parameter 'path1')
return MsgBoxYesNo(strMsg, strTitle); // if error show the standard dialog
}
}
public static bool EnMsgBoxYesNo(in string strMsg, in string strDescription = ClsStrings_ITA.STR_DLG_QUESTION, in string strTitle = ClsConstants.STR_PROJ_TITLE)
{
try
{
// Initialization:
Microsoft.WindowsAPICodePack.Dialogs.TaskDialog dialog = new()
{
Caption = strTitle,
InstructionText = strDescription,
Text = strMsg,
StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No,
Icon = TaskDialogStandardIcon.Warning /* non trovo l'icona del punto interrogativo!!! :( */
};
// Show dialog:
TaskDialogResult result = dialog.Show();
// Check user input:
if (result == TaskDialogResult.Yes)
{
return true; // yes
}
else
{
return false; // no
}
}
catch (Exception ex)
{
MsgErrorHandler(ex.Message, ClsStrings_ITA.STR_ERR_MSGBOX_INFO); // ERROR: Value cannot be null. (Parameter 'path1')
return MsgBoxYesNo(strMsg, strTitle); // if error show the standard dialog
}
}
15 replies
CC#
Created by Silver Black on 9/11/2024 in #help
How to distribute VisualStyles for dialogs Vista style - FIXED!
My target framework is ".NET 8.0". The weird thing is that if I run the executable from the "bin\Release\net8.0-windows\publish\self-contained" folder I have the glitch, while from the "bin\Debug\net8.0-windows" it runs ok, so also on the same development machine!
15 replies
CC#
Created by Silver Black on 9/11/2024 in #help
How to distribute VisualStyles for dialogs Vista style - FIXED!
@reflectronic
public static bool EnMsgBoxYesNo(in string strMsg, in string strDescription = ClsStrings_ITA.STR_DLG_QUESTION, in string strTitle = ClsConstants.STR_PROJ_TITLE)
{
try
{
// Initialization:
Microsoft.WindowsAPICodePack.Dialogs.TaskDialog dialog = new()
{
Caption = strTitle,
InstructionText = strDescription,
Text = strMsg,
StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No,
Icon = TaskDialogStandardIcon.Warning
};
// Show dialog:
TaskDialogResult result = dialog.Show();
// Check user input:
if (result == TaskDialogResult.Yes)
{
return true; // yes
}
else
{
return false; // no
}
}
catch (Exception)
{
return MsgBoxYesNo(strMsg, strTitle); // standard dialog
}
}
public static bool EnMsgBoxYesNo(in string strMsg, in string strDescription = ClsStrings_ITA.STR_DLG_QUESTION, in string strTitle = ClsConstants.STR_PROJ_TITLE)
{
try
{
// Initialization:
Microsoft.WindowsAPICodePack.Dialogs.TaskDialog dialog = new()
{
Caption = strTitle,
InstructionText = strDescription,
Text = strMsg,
StandardButtons = TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No,
Icon = TaskDialogStandardIcon.Warning
};
// Show dialog:
TaskDialogResult result = dialog.Show();
// Check user input:
if (result == TaskDialogResult.Yes)
{
return true; // yes
}
else
{
return false; // no
}
}
catch (Exception)
{
return MsgBoxYesNo(strMsg, strTitle); // standard dialog
}
}
15 replies
CC#
Created by Silver Black on 4/29/2024 in #help
Control for showing icons (.ICO files) (WinForms .Net 8)
I think I found a way: when selecting the image of the PictureBox control, just select "All files" in the filter combobox of the open dialog box and it's done, the ICO is imported and shown as a PNG or any other file.
9 replies
CC#
Created by Silver Black on 4/29/2024 in #help
Control for showing icons (.ICO files) (WinForms .Net 8)
OK thank you. Maybe I'll do my own control then, as you said.
9 replies
CC#
Created by Silver Black on 4/29/2024 in #help
Control for showing icons (.ICO files) (WinForms .Net 8)
So there is actually no control in VS that handles .ICO files? I used to use icons all the times in my apps...
9 replies
CC#
Created by Silver Black on 3/15/2024 in #help
After updating to v17.9.3 Visual Studio IDE closes at start with error message [FIXED]
OK, I find the fix for .Net 8.03 and VS 2022 Community Edition v17.9.3.
I was not the only one having this issue, it seems something going wrong with 8.0.3 version. The fix is described here: https://stackoverflow.com/questions/78175061/visual-studio-2022-error-after-updating-to-17-9-3-hostcrashexception-failed-t/78183392#78183392 I report the solutions here for semplicity: * Step 1: Downloading .NET Core version 8.0.2 Binaries from link below: https://versionsof.net/core/8.0/8.0.2/ * Step 2: Navigate to path below(replace the path with your current vs path): C:\Program Files\Microsoft Visual Studio\2022\Community\dotnet\net8.0\runtime\shared\Microsoft.NETCore.App there is a folder with name "8.0.3" rename that folder to something else, like "_8.0.3" (to hold it as a backup of the original one) * Step 3: open the downloaded archive, extract the folder "shared\Microsoft.NETCore.App\8.0.2" from it and place it to the path mentioned in step 2 * Step 4: Rename the folder you got from that archive at step 3 to "8.0.3" Now try opening the Visual studio again and check if its working. I just had to replace the "8.0.3" folder with the renamed "8.0.2" (taken from the archive mentioned in the link ) in both the following path: * C:\Program Files\Microsoft Visual Studio\2022\Community\dotnet\net8.0\runtime\shared\Microsoft.NETCore.App * C:\Program Files\dotnet\shared\Microsoft.NETCore.App If anyone have some issues, be sure to change the folder in both this path. Now let's have more fun with VS .Net and C#! 🙂
44 replies
CC#
Created by Silver Black on 3/15/2024 in #help
After updating to v17.9.3 Visual Studio IDE closes at start with error message [FIXED]
Pro, because I cannot find an older Community 2022 version.
44 replies
CC#
Created by Silver Black on 3/15/2024 in #help
After updating to v17.9.3 Visual Studio IDE closes at start with error message [FIXED]
VS 2022 17.6 works...
44 replies
CC#
Created by Silver Black on 3/15/2024 in #help
After updating to v17.9.3 Visual Studio IDE closes at start with error message [FIXED]
Version 7.0.17 works...
44 replies
CC#
Created by Silver Black on 3/15/2024 in #help
After updating to v17.9.3 Visual Studio IDE closes at start with error message [FIXED]
My machine is quite old (15 yo - CPU Intel CoreDuo Quad Q9550 @ 2.8 GHz - 8 GB RAM) and I installed Win11 skipping the requirements with some tricks. Could it be this the cause?
44 replies
CC#
Created by rsx on 3/14/2024 in #help
windows application can not find the location of .NET
23 replies
CC#
Created by rsx on 3/14/2024 in #help
windows application can not find the location of .NET
Thank you, I'll reinstall Windows from scratch and report back if any issues arise again. Thank you for your time and patience.
23 replies
CC#
Created by rsx on 3/14/2024 in #help
windows application can not find the location of .NET
Anyone knows where I can download a previous versione of VS 2022 Community from? Like the 17.9 or even 17.8 version.
23 replies
CC#
Created by rsx on 3/14/2024 in #help
windows application can not find the location of .NET
And yes, I reinstalled the Community version.
23 replies
CC#
Created by rsx on 3/14/2024 in #help
windows application can not find the location of .NET
I further investigated and found that if I use PowerShell or Developer Power Shell for Visual Studio (instead of Command Prompt and Developer Command Prompt for Visual Studio), I get "Fatal error" any dotnet.exe I execute, no matter form where I execute it (Program Files, Program Filex (x86), Program Files\Microsoft Visual Studio\2022\Community\dotnet\net8.0\runtime).
23 replies
CC#
Created by Silver Black on 3/15/2024 in #help
After updating to v17.9.3 Visual Studio IDE closes at start with error message [FIXED]
The last resort is to format and reinstall Windows from scratch.
44 replies
CC#
Created by Silver Black on 3/15/2024 in #help
After updating to v17.9.3 Visual Studio IDE closes at start with error message [FIXED]
Yeah, maybe... I removed every .Net SDK package, VS and other related things, then installed Win11 23H2 and reinstalled VS2022 CE 17.9.3. Nothing changed...
44 replies