public static Process StartApplication(ServerType hostType, KreFlavor kreFlavor, KreArchitecture kreArchitecture, string identityDbName) { string applicationPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, APP_RELATIVE_PATH)); //Tweak the %PATH% to the point to the right KREFLAVOR Environment.SetEnvironmentVariable("PATH", SwitchPathToKreFlavor(kreFlavor, kreArchitecture)); var backupKreDefaultLibPath = Environment.GetEnvironmentVariable("KRE_DEFAULT_LIB"); //To avoid the KRE_DEFAULT_LIB of the test process flowing into Helios, set it to empty Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", string.Empty); Process hostProcess = null; if (hostType == ServerType.Helios) { hostProcess = StartHeliosHost(applicationPath, kreArchitecture); } else { hostProcess = StartSelfHost(hostType, applicationPath, identityDbName); } //Restore the KRE_DEFAULT_LIB after starting the host process Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", backupKreDefaultLibPath); return(hostProcess); }
private static string SwitchPathToKreFlavor(KreFlavor kreFlavor) { var pathValue = Environment.GetEnvironmentVariable("PATH"); Console.WriteLine(); Console.WriteLine("Current %PATH% value : {0}", pathValue); pathValue = (kreFlavor == KreFlavor.CoreClr) ? pathValue.Replace("KRE-svr50-", "KRE-svrc50-") : pathValue.Replace("KRE-svrc50-", "KRE-svr50-"); Console.WriteLine(); Console.WriteLine("Setting %PATH% value to : {0}", pathValue); return(pathValue); }
private static string SwitchPathToKreFlavor(KreFlavor kreFlavor, KreArchitecture kreArchitecture) { var pathValue = Environment.GetEnvironmentVariable("PATH"); Console.WriteLine(); Console.WriteLine("Current %PATH% value : {0}", pathValue); StringBuilder replaceStr = new StringBuilder(); replaceStr.Append("KRE"); replaceStr.Append((kreFlavor == KreFlavor.CoreClr) ? "-CoreCLR" : "-CLR"); replaceStr.Append((kreArchitecture == KreArchitecture.x86) ? "-x86" : "-amd64"); pathValue = Regex.Replace(pathValue, "KRE-(CLR|CoreCLR)-(x86|amd64)", replaceStr.ToString(), RegexOptions.IgnoreCase); Console.WriteLine(); Console.WriteLine("Setting %PATH% value to : {0}", pathValue); return(pathValue); }
public static Process StartApplication(HostType hostType, KreFlavor kreFlavor, string identityDbName) { string applicationPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, APP_RELATIVE_PATH)); //Tweak the %PATH% to the point to the right KREFLAVOR Environment.SetEnvironmentVariable("PATH", SwitchPathToKreFlavor(kreFlavor)); var backupKreDefaultLibPath = Environment.GetEnvironmentVariable("KRE_DEFAULT_LIB"); //To avoid the KRE_DEFAULT_LIB of the test process flowing into Helios, set it to empty Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", string.Empty); Process hostProcess = null; if (hostType == HostType.Helios) { hostProcess = StartHeliosHost(applicationPath); } else { hostProcess = StartSelfHost(applicationPath, identityDbName); } //Restore the KRE_DEFAULT_LIB after starting the host process Environment.SetEnvironmentVariable("KRE_DEFAULT_LIB", backupKreDefaultLibPath); return hostProcess; }
private static string SwitchPathToKreFlavor(KreFlavor kreFlavor) { var pathValue = Environment.GetEnvironmentVariable("PATH"); Console.WriteLine(); Console.WriteLine("Current %PATH% value : {0}", pathValue); pathValue = (kreFlavor == KreFlavor.CoreClr) ? pathValue.Replace("KRE-svr50-", "KRE-svrc50-") : pathValue.Replace("KRE-svrc50-", "KRE-svr50-"); Console.WriteLine(); Console.WriteLine("Setting %PATH% value to : {0}", pathValue); return pathValue; }
// Uncomment Core CLR on x64 after following bugs are resolved // https://github.com/aspnet/Identity/issues/157 // https://github.com/aspnet/Mvc/issues/846 //[InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5001/")] //[InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x64, "http://localhost:5004/")] public void SmokeTestSuite(ServerType hostType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", hostType, kreFlavor, architecture, applicationBaseUrl); // Check if processor architecture is x64, else skip test if (architecture == KreArchitecture.x64 && !Environment.Is64BitOperatingSystem) { Console.WriteLine("Skipping x64 test since machine is of type x86"); Assert.True(true); return; } var testStartTime = DateTime.Now; var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); Console.WriteLine("Pointing MusicStore DB to '{0}'", string.Format(Connection_string_Format, musicStoreDbName)); //Override the connection strings using environment based configuration Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(Connection_string_Format, musicStoreDbName)); ApplicationBaseUrl = applicationBaseUrl; Process hostProcess = null; bool testSuccessful = false; try { hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, architecture, musicStoreDbName); httpClientHandler = new HttpClientHandler(); httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) }; //Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = httpClient.GetAsync(string.Empty).Result; var responseContent = response.Content.ReadAsStringAsync().Result; var initializationCompleteTime = DateTime.Now; Console.WriteLine("[Time]: Approximate time taken for application initialization : '{0}' seconds", (initializationCompleteTime - testStartTime).TotalSeconds); VerifyHomePage(response, responseContent); //Verify the static file middleware can serve static content VerifyStaticContentServed(); //Making a request to a protected resource should automatically redirect to login page AccessStoreWithoutPermissions(); //Register a user - Negative scenario where the Password & ConfirmPassword do not match RegisterUserWithNonMatchingPasswords(); //Register a valid user var generatedUserName = RegisterValidUser(); //Register a user - Negative scenario : Trying to register a user name that's already registered. RegisterExistingUser(generatedUserName); //Logout from this user session - This should take back to the home page SignOutUser(generatedUserName); //Sign in scenarios: Invalid password - Expected an invalid user name password error. SignInWithInvalidPassword(generatedUserName, "InvalidPassword~1"); //Sign in scenarios: Valid user name & password. SignInWithUser(generatedUserName, "Password~1"); //Change password scenario ChangePassword(generatedUserName); //SignIn with old password and verify old password is not allowed and new password is allowed SignOutUser(generatedUserName); SignInWithInvalidPassword(generatedUserName, "Password~1"); SignInWithUser(generatedUserName, "Password~2"); //Making a request to a protected resource that this user does not have access to - should automatically redirect to login page again AccessStoreWithoutPermissions(generatedUserName); //Logout from this user session - This should take back to the home page SignOutUser(generatedUserName); //Login as an admin user SignInWithUser("Administrator", "YouShouldChangeThisPassword1!"); //Now navigating to the store manager should work fine as this user has the necessary permission to administer the store. AccessStoreWithPermissions(); //Create an album var albumName = CreateAlbum(); var albumId = FetchAlbumIdFromName(albumName); //Get details of the album VerifyAlbumDetails(albumId, albumName); //Add an album to cart and checkout the same AddAlbumToCart(albumId, albumName); CheckOutCartItems(); //Delete the album from store DeleteAlbum(albumId, albumName); //Logout from this user session - This should take back to the home page SignOutUser("Administrator"); var testCompletionTime = DateTime.Now; Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds); Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds); testSuccessful = true; } finally { if (!testSuccessful) { Console.WriteLine("Some tests failed. Proceeding with cleanup."); } if (hostProcess != null && !hostProcess.HasExited) { //Shutdown the host process hostProcess.Kill(); hostProcess.WaitForExit(5 * 1000); if (!hostProcess.HasExited) { Console.WriteLine("Unable to terminate the host process with process Id '{0}", hostProcess.Id); } else { Console.WriteLine("Successfully terminated host process with process Id '{0}'", hostProcess.Id); } } else { Console.WriteLine("Host process already exited or never started successfully."); } DbUtils.DropDatabase(musicStoreDbName); } }
//WindowsIdentity not available on CoreCLR //[InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5001/", false)] //[InlineData(ServerType.WebListener, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5002/", false)] public void NtlmAuthenticationTest(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl, bool RunTestOnMono = false) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", serverType, kreFlavor, architecture, applicationBaseUrl); if (Helpers.SkipTestOnCurrentConfiguration(RunTestOnMono, architecture)) { Assert.True(true); return; } var startParameters = new StartParameters { ServerType = serverType, KreFlavor = kreFlavor, KreArchitecture = architecture, EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication' ApplicationHostConfigTemplateContent = (serverType == ServerType.Helios) ? File.ReadAllText("NtlmAuthentation.config") : null, SiteName = "MusicStoreNtlmAuthentication" //This is configured in the NtlmAuthentication.config }; var testStartTime = DateTime.Now; var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); Console.WriteLine("Pointing MusicStore DB to '{0}'", string.Format(Connection_string_Format, musicStoreDbName)); //Override the connection strings using environment based configuration Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(Connection_string_Format, musicStoreDbName)); ApplicationBaseUrl = applicationBaseUrl; Process hostProcess = null; bool testSuccessful = false; try { hostProcess = DeploymentUtility.StartApplication(startParameters, musicStoreDbName); httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) }; //Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = httpClient.GetAsync(string.Empty).Result; var responseContent = response.Content.ReadAsStringAsync().Result; var initializationCompleteTime = DateTime.Now; Console.WriteLine("[Time]: Approximate time taken for application initialization : '{0}' seconds", (initializationCompleteTime - testStartTime).TotalSeconds); VerifyHomePage(response, responseContent, true); //Check if the user name appears in the page Assert.Contains(string.Format("{0}\\{1}", Environment.UserDomainName, Environment.UserName), responseContent, StringComparison.OrdinalIgnoreCase); if (serverType != ServerType.Helios) { //https://github.com/aspnet/Helios/issues/53 //Should be able to access the store as the Startup adds necessary permissions for the current user AccessStoreWithPermissions(); } var testCompletionTime = DateTime.Now; Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds); Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds); testSuccessful = true; } finally { if (!testSuccessful) { Console.WriteLine("Some tests failed. Proceeding with cleanup."); } DeploymentUtility.CleanUpApplication(startParameters, hostProcess, musicStoreDbName); } }
//Native module variation requires some more work //[InlineData(ServerType.HeliosNativeModule, KreFlavor.CoreClr, KreArchitecture.x86, "http://*****:*****@test.com", "YouShouldChangeThisPassword1!"); //Now navigating to the store manager should work fine as this user has the necessary permission to administer the store. AccessStoreWithPermissions(); //Create an album var albumName = CreateAlbum(); var albumId = FetchAlbumIdFromName(albumName); //Get details of the album VerifyAlbumDetails(albumId, albumName); //Get the non-admin view of the album. GetAlbumDetailsFromStore(albumId, albumName); //Add an album to cart and checkout the same AddAlbumToCart(albumId, albumName); CheckOutCartItems(); //Delete the album from store DeleteAlbum(albumId, albumName); //Logout from this user session - This should take back to the home page SignOutUser("Administrator"); //Google login LoginWithGoogle(); //Facebook login LoginWithFacebook(); //Twitter login LoginWithTwitter(); //MicrosoftAccountLogin LoginWithMicrosoftAccount(); var testCompletionTime = DateTime.Now; Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds); Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds); testSuccessful = true; } finally { if (!testSuccessful) { Console.WriteLine("Some tests failed. Proceeding with cleanup."); } DeploymentUtility.CleanUpApplication(startParameters, hostProcess, musicStoreDbName); } }
public void SmokeTestSuite(HostType hostType, KreFlavor kreFlavor, string applicationBaseUrl) { var testStartTime = DateTime.Now; var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); var musicStoreIdentityDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); Console.WriteLine("Pointing MusicStore DB to '{0}'", string.Format(Connection_string_Format, musicStoreDbName)); Console.WriteLine("Pointing MusicStoreIdentity DB to '{0}'", string.Format(Connection_string_Format, musicStoreIdentityDbName)); //Override the connection strings using environment based configuration Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(Connection_string_Format, musicStoreDbName)); Environment.SetEnvironmentVariable("SQLAZURECONNSTR_IdentityConnection", string.Format(Connection_string_Format, musicStoreIdentityDbName)); ApplicationBaseUrl = applicationBaseUrl; Process hostProcess = null; try { hostProcess = DeploymentUtility.StartApplication(hostType, kreFlavor, musicStoreIdentityDbName); httpClientHandler = new HttpClientHandler(); httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) }; //Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = httpClient.GetAsync(string.Empty).Result; var responseContent = response.Content.ReadAsStringAsync().Result; var initializationCompleteTime = DateTime.Now; Console.WriteLine("[Time]: Approximate time taken for application initialization : '{0}' seconds", (initializationCompleteTime - testStartTime).TotalSeconds); VerifyHomePage(response, responseContent); //Making a request to a protected resource should automatically redirect to login page AccessStoreWithoutPermissions(); //Register a user - Negative scenario where the Password & ConfirmPassword do not match RegisterUserWithNonMatchingPasswords(); //Register a valid user var generatedUserName = RegisterValidUser(); //Register a user - Negative scenario : Trying to register a user name that's already registered. RegisterExistingUser(generatedUserName); //Logout from this user session - This should take back to the home page SignOutUser(generatedUserName); //Sign in scenarios: Invalid password - Expected an invalid user name password error. SignInWithInvalidPassword(generatedUserName, "InvalidPassword~1"); //Sign in scenarios: Valid user name & password. SignInWithUser(generatedUserName, "Password~1"); //Change password scenario ChangePassword(generatedUserName); //SignIn with old password and verify old password is not allowed and new password is allowed SignOutUser(generatedUserName); SignInWithInvalidPassword(generatedUserName, "Password~1"); SignInWithUser(generatedUserName, "Password~2"); //Making a request to a protected resource that this user does not have access to - should automatically redirect to login page again AccessStoreWithoutPermissions(generatedUserName); //Logout from this user session - This should take back to the home page SignOutUser(generatedUserName); //Login as an admin user SignInWithUser("Administrator", "YouShouldChangeThisPassword1!"); //Now navigating to the store manager should work fine as this user has the necessary permission to administer the store. AccessStoreWithPermissions(); //Create an album var albumName = CreateAlbum(); var albumId = FetchAlbumIdFromName(albumName); //Get details of the album VerifyAlbumDetails(albumId, albumName); //Logout from this user session - This should take back to the home page SignOutUser("Administrator"); var testCompletionTime = DateTime.Now; Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds); Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds); } finally { if (hostProcess != null && !hostProcess.HasExited) { //Shutdown the host process hostProcess.Kill(); hostProcess.WaitForExit(5 * 1000); if (!hostProcess.HasExited) { Console.WriteLine("Unable to terminate the host process with process Id '{0}", hostProcess.Id); } else { Console.WriteLine("Successfully terminated host process with process Id '{0}'", hostProcess.Id); } } else { Console.WriteLine("Host process already exited or never started successfully."); } DbUtils.DropDatabase(musicStoreDbName); DbUtils.DropDatabase(musicStoreIdentityDbName); } }
public void PublishAndRunTests(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl, bool RunTestOnMono = false) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", serverType, kreFlavor, architecture, applicationBaseUrl); if (Helpers.SkipTestOnCurrentConfiguration(RunTestOnMono, architecture)) { Assert.True(true); return; } var startParameters = new StartParameters { ServerType = serverType, KreFlavor = kreFlavor, KreArchitecture = architecture, PackApplicationBeforeStart = true }; var testStartTime = DateTime.Now; var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); Console.WriteLine("Pointing MusicStore DB to '{0}'", string.Format(Connection_string_Format, musicStoreDbName)); //Override the connection strings using environment based configuration Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(Connection_string_Format, musicStoreDbName)); ApplicationBaseUrl = applicationBaseUrl; Process hostProcess = null; bool testSuccessful = false; try { hostProcess = DeploymentUtility.StartApplication(startParameters, musicStoreDbName); httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) }; HttpResponseMessage response = null; string responseContent = null; var initializationCompleteTime = DateTime.MinValue; //Request to base address and check if various parts of the body are rendered & measure the cold startup time. //Add retry logic since tests are flaky on mono due to connection issues for (int retryCount = 0; retryCount < 3; retryCount++) { try { response = httpClient.GetAsync(string.Empty).Result; responseContent = response.Content.ReadAsStringAsync().Result; initializationCompleteTime = DateTime.Now; Console.WriteLine("[Time]: Approximate time taken for application initialization : '{0}' seconds", (initializationCompleteTime - testStartTime).TotalSeconds); break; //Went through successfully } catch (AggregateException exception) { // Both type exceptions thrown by Mono which are resolved by retry logic if (exception.InnerException is HttpRequestException || exception.InnerException is WebException) { Console.WriteLine("Failed to complete the request with error: {0}", exception.ToString()); Console.WriteLine("Retrying request.."); Thread.Sleep(1 * 1000); //Wait for a second before retry } } } VerifyHomePage(response, responseContent, true); //Static files are served? VerifyStaticContentServed(); if (serverType != ServerType.Helios) { if (Directory.GetFiles(startParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0) { throw new Exception("packExclude parameter values are not honored"); } } var testCompletionTime = DateTime.Now; Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds); Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds); testSuccessful = true; } finally { if (!testSuccessful) { Console.WriteLine("Some tests failed. Proceeding with cleanup."); } DeploymentUtility.CleanUpApplication(startParameters, hostProcess, musicStoreDbName); } }
//[InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5002/", false)] //[InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5004/", true)] public void PublishAndRunTests(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl, bool RunTestOnMono = false) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", serverType, kreFlavor, architecture, applicationBaseUrl); if (Helpers.SkipTestOnCurrentConfiguration(RunTestOnMono, architecture)) { Assert.True(true); return; } var startParameters = new StartParameters { ServerType = serverType, KreFlavor = kreFlavor, KreArchitecture = architecture, PackApplicationBeforeStart = true }; var testStartTime = DateTime.Now; var musicStoreDbName = Guid.NewGuid().ToString().Replace("-", string.Empty); Console.WriteLine("Pointing MusicStore DB to '{0}'", string.Format(Connection_string_Format, musicStoreDbName)); //Override the connection strings using environment based configuration Environment.SetEnvironmentVariable("SQLAZURECONNSTR_DefaultConnection", string.Format(Connection_string_Format, musicStoreDbName)); ApplicationBaseUrl = applicationBaseUrl; Process hostProcess = null; bool testSuccessful = false; try { hostProcess = DeploymentUtility.StartApplication(startParameters, musicStoreDbName); httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(applicationBaseUrl) }; //Request to base address and check if various parts of the body are rendered & measure the cold startup time. var response = httpClient.GetAsync(string.Empty).Result; var responseContent = response.Content.ReadAsStringAsync().Result; var initializationCompleteTime = DateTime.Now; Console.WriteLine("[Time]: Approximate time taken for application initialization : '{0}' seconds", (initializationCompleteTime - testStartTime).TotalSeconds); VerifyHomePage(response, responseContent, true); //Static files are served? VerifyStaticContentServed(); var testCompletionTime = DateTime.Now; Console.WriteLine("[Time]: All tests completed in '{0}' seconds", (testCompletionTime - initializationCompleteTime).TotalSeconds); Console.WriteLine("[Time]: Total time taken for this test variation '{0}' seconds", (testCompletionTime - testStartTime).TotalSeconds); testSuccessful = true; } finally { if (!testSuccessful) { Console.WriteLine("Some tests failed. Proceeding with cleanup."); } DeploymentUtility.CleanUpApplication(startParameters, hostProcess, musicStoreDbName); } }
private static string SwitchPathToKreFlavor(KreFlavor kreFlavor, KreArchitecture kreArchitecture) { var pathValue = Environment.GetEnvironmentVariable("PATH"); Console.WriteLine(); Console.WriteLine("Current %PATH% value : {0}", pathValue); StringBuilder replaceStr = new StringBuilder(); replaceStr.Append("KRE"); replaceStr.Append((kreFlavor == KreFlavor.CoreClr) ? "-svrc50" : "-svr50"); replaceStr.Append((kreArchitecture == KreArchitecture.x86) ? "-x86" : "-x64"); pathValue = Regex.Replace(pathValue, "KRE-(svr|svrc)50-(x86|x64)", replaceStr.ToString(), RegexOptions.IgnoreCase); Console.WriteLine(); Console.WriteLine("Setting %PATH% value to : {0}", pathValue); return pathValue; }