2015年2月26日 / kirito / 0 Comments
We only need to create a new file called xxx.exe.config.
note: xxx.exe is your donet application.
Then fill the following codes to the config file:
|
<?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration> |
2015年1月29日 / kirito / 3 Comments
When I develop a new winform application, if I start debug a process and then stop it, it will no longer debug again, and it shows like the following below:
warning MSB3026: Could not copy “obj\x86\Debug\xxx.pdb” to “bin\Debug\xxx.pdb”. Beginning retry 1 in 1000ms. The process cannot access the file ‘bin\Debug\xxx.pdb’ because it is being used by another process.
And After looking into it, I found a process name “conhost.exe” is still exist after the debugger stops. So I closed it manually. And the debugger will work. But this is not a perfect workaround. So I found an other workaround, the issue may happened by VS 2015 new feature, it called Analyzer. When the Analyzer is disable, the issue no longer exist. Maybe this is the perfect workaround.
If the above solution does not work, please delete .vs folder and .suo file and then try again.
————————–
Update on 2/26/2015
The issue may fixed in CTP6, please have a try.
2014年9月10日 / kirito / 0 Comments
When we are using the VS 2010 and trying to release our application to the customer, we sometimes use the default deployment project to create a simple msi package as the solution. But if any update is released, it is very important to change the Version/ProductCode of our vdproj project, and we need to modify the uninstaller’s ProductCode. If more projects, we need modify more uninstallers. Is there any solution or workaround to avoid the bothering work? Of course, there is.
1. You should get the following code to create a project named “ProductCodeFixer”:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
class Program { //origub ProductCode: private static string OriCode = "0F67F96D-15F3-4BCC-BF13-9B634C2D7A48"; private static string targetExe = Path.Combine(System.Windows.Forms.Application.StartupPath, "Uninstall.exe"); static void Main(string[] args) { if (args.Length == 0 || !File.Exists(args[0]) || !args[0].Contains(".vdproj")) { Console.WriteLine("could not find .vdproj file"); return; } Console.WriteLine("ProductCodeFixer start"); string dir = System.Windows.Forms.Application.StartupPath; string productCode = ""; Console.WriteLine("Fixing File from: " + args[0]); using (StreamReader sr = new StreamReader(args[0])) { string entireFile = sr.ReadToEnd(); Regex regex = new Regex("(?<=\"ProductCode\" = \"8:{).*?(?=}\")"); Match match = regex.Match(entireFile); if (string.IsNullOrEmpty(match.Value)) { Console.WriteLine("Could not find product in: " + args[0]); return; } if (match.Value.Length != OriCode.Length) { Console.WriteLine("Matched string does not the ProductCode"); return; } productCode = match.Value; } if (!string.IsNullOrEmpty(productCode)) { using (FileStream fs = new FileStream(targetExe, FileMode.Open, FileAccess.ReadWrite)) { fs.Position = 1974; foreach(char ch in productCode) { fs.WriteByte((byte)ch); fs.WriteByte(0); } } Console.WriteLine("Fix complete"); } } } |
2. Add the ProductCodeFixer to uninstaller’s directory, and set an vdproj file path as a parameter, the ProductCodeFixer will automaticly change the uninstaller’s version.
Note: You can get the uninstaller from here.
3. Before creating the msi package, we should add PreBuildEvent to our project like the following: “$(ProjectDir)\xxxx\ProductCodeFixer.exe” “$(ProjectDir)\xxxx\our_proj.vdproj” . After running PreBuildEvent, you’ll get a new uninstaller for the new msi package.