I have packaged a .NET application in the form of a .zip file.
The user needs to unzip the file on his local hard drive to create a directory with an executable and associated resources.
However, users keep unzipping the file on a network drive and execute the app from there, and they get problems because of this.
Can I force users to run the file from their local hard drive by displaying a message if they run it from a network drive and closing the app ?
You only need to check if the path is a network path and give an error message.
Steps:
Get path or running application:
var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);Check if path is a network path:
[DllImport("shlwapi.dll")]private static extern bool PathIsNetworkPath(string pszPath);if(PathIsNetworkPath(path))...Give error message
Refer: PathIsNetworkPath