Home > Net >  The debug and Realse path is different, the setup project insatller how to set up the program data p
The debug and Realse path is different, the setup project insatller how to set up the program data p

Time:01-17

Program is running will need a lot of external files,
Such as downloading data in an Excel template; That the Excel template should be placed ahead of a place, and then the runtime copy in the past, that a lot of something such as Excel template file, I put them in a Resource,


The program is running, direct
"Private string BootPath=System. The AppDomain. CurrentDomain. BaseDirectory;" Can be obtained;
For example,
String Str=File. ReadAllText (BootPath + @ \ Resources \ Mapping TXT, System. Text. The Encoding. GetEncoding (" GBK "));

But I now the question is the debug and Realse BootPath mode is different, so I must be set in the debug and Realse folder a Resource file,
Trouble, often the problem is a changed, another forget change,

Actually I also found the solution to this problem, is that you can put the Resource in other locations, such as
"Private string BootPath=@" C: \ "" ok;

But the new problem appeared;
I finally reasle file is generated using the setup project insatller generated msi sent to the customer, in the customer after installation program, I was the Resource to install the program directory, is hope running a private string BootPath=System. AppDomain. CurrentDomain. BaseDirectory; Rather than gave people a new file on disk C,
Excuse me, this topic how to work out,
  •  Tags:  
  • C#
  • Related