I wrote a ClickOnce Application with similar problems. I overcame those problems and even figured out how to email an activation key once the software was paid for.
By having your App use the windows registry you can test to see if this is the first time the App is being run.
void OnFirstRun()
{
String StartupPath = System.Windows.Forms.Application.StartupPath;
String OrigMktDataPath = Path.Combine(StartupPath, "MktData");
String localAppData = Environment.GetFolderPath
(Environment.SpecialFolder.LocalApplicationData);
String DestPath = Path.Combine(localAppData, @"YourCompanyName\YourAppName\");
DirectoryInfo diSource = new DirectoryInfo(OrigMktDataPath);
DirectoryInfo diDest = new DirectoryInfo(DestPath);
try
{
if (diSource.Exists)
{
if (!diDest.Exists)
{
Directory.CreateDirectory(destPath);
}
bool OverWrite = false;
CopyDir(OrigMktDataPath, DestPath, OverWrite);
}
}
catch (Exception ex)
{
regWrap.WriteLogException(ex);
regWrap.FlushFileStream();
}
}
private void CopyDir(String PathSrc, String PathDest, bool OverWrite)
{
DirectoryInfo diSource = new DirectoryInfo(PathSrc);
FileInfo[] files = diSource.GetFiles();
String DestFFN;
foreach (FileInfo fi in files)
{
DestFFN = PathDest + fi.Name;
if (!File.Exists(DestFFN) || OverWrite)
{
fi.CopyTo(DestFFN, true);
File.SetAttributes(DestFFN, FileAttributes.Normal);
}
}
}