Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.Diagnostics.Debugger.Break()
- [TestClass] public class InstallerTest {
- [TestMethod]
- public void InstallTest() {
- // substitute with your installer component here
- DataWarehouseInstall installer = new DataWarehouseInstall();
- string assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- string installLogFilePath = Path.Combine(assemblyDirectory, "install.log");
- installer.Context = new System.Configuration.Install.InstallContext(installLogFilePath, null);
- // Refactor to set any parameters for your installer here
- installer.Context.Parameters.Add("Server", ".");
- //installer.Context.Parameters.Add("User", "");
- //installer.Context.Parameters.Add("Password", "");
- installer.Context.Parameters.Add("DatabaseName", "MyDatabaseInstallMsiTest");
- //installer.Context.Parameters.Add("DatabasePath", "");
- // Our test isn't injecting any save state so we give a default instance for the stateSaver
- installer.Install(new Hashtable());
- } }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- namespace MyCompany.Deployment
- {
- /// <summary>
- /// Enables a quick and easy method of debugging custom actions.
- /// </summary>
- class LogFile
- {
- const string FileName = "MyCompany.Deployment.log";
- readonly string _filePath;
- public LogFile(string primaryOutputPath)
- {
- var dir = Path.GetDirectoryName(primaryOutputPath);
- _filePath = Path.Combine(dir, FileName);
- }
- public void Print(Exception ex)
- {
- File.AppendAllText(_filePath, "Error: " + ex.Message + Environment.NewLine +
- "Stack Trace: " + Environment.NewLine + ex.StackTrace + Environment.NewLine);
- }
- public void Print(string format, params object[] args)
- {
- var text = String.Format(format, args) + Environment.NewLine;
- File.AppendAllText(_filePath, text);
- }
- public void PrintLine() { Print(""); }
- }
- }
- Context.LogMessage("My message");
Add Comment
Please, Sign In to add comment