public void PublishOptionsTest(string testIdentifier, string framework, string runtime, string config, string outputDir) { TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary", identifier: testIdentifier) .WithLockFiles() .WithBuildArtifacts(); string testRoot = _getProjectJson(instance.TestRoot, "TestApp"); outputDir = string.IsNullOrEmpty(outputDir) ? "" : Path.Combine(instance.TestRoot, outputDir); var publishCommand = new PublishCommand(testRoot, output: outputDir); publishCommand.Execute().Should().Pass(); // verify the output executable generated var publishedDir = publishCommand.GetOutputDirectory(); var outputExe = publishCommand.GetOutputExecutable(); var outputPdb = Path.ChangeExtension(outputExe, "pdb"); // lets make sure that the output exe is runnable var outputExePath = Path.Combine(publishedDir.FullName, publishCommand.GetOutputExecutable()); var command = new TestCommand(outputExePath); command.Execute("").Should().ExitWith(100); // the pdb should also be published publishedDir.Should().HaveFile(outputPdb); }
public void PublishTestAppWithContentPackage() { var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithContentPackage") .WithLockFiles(); var publishCommand = new PublishCommand(testInstance.TestRoot); var publishResult = publishCommand.Execute(); publishResult.Should().Pass(); var publishDir = publishCommand.GetOutputDirectory(portable: false); publishDir.Should().HaveFiles(new[] { $"AppWithContentPackage{publishCommand.GetExecutableExtension()}", "AppWithContentPackage.dll", "AppWithContentPackage.deps.json" }); // these files come from the contentFiles of the SharedContentA dependency publishDir .Sub("scripts") .Should() .Exist() .And .HaveFile("run.cmd"); publishDir .Should() .HaveFile("config.xml"); }
public void PublishOptionsTest(string framework, string runtime, string config, string outputDir) { // create unique directories in the 'temp' folder var root = Temp.CreateDirectory(); var testAppDir = root.CreateDirectory("TestApp"); var testLibDir = root.CreateDirectory("TestLibrary"); //copy projects to the temp dir CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestApp"), testAppDir); CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibrary"), testLibDir); RunRestore(testAppDir.Path); RunRestore(testLibDir.Path); // run publish outputDir = string.IsNullOrEmpty(outputDir) ? "" : Path.Combine(root.Path, outputDir); var testProject = GetProjectPath(testAppDir); var publishCommand = new PublishCommand(testProject, output: outputDir); publishCommand.Execute().Should().Pass(); // verify the output executable generated var publishedDir = publishCommand.GetOutputDirectory(); var outputExe = publishCommand.GetOutputExecutable(); var outputPdb = Path.ChangeExtension(outputExe, "pdb"); // lets make sure that the output exe is runnable var outputExePath = Path.Combine(publishedDir.FullName, publishCommand.GetOutputExecutable()); var command = new TestCommand(outputExePath); command.Execute("").Should().ExitWith(100); // the pdb should also be published publishedDir.Should().HaveFile(outputPdb); }
public void PublishExcludesBuildDependencies() { var testInstance = TestAssetsManager.CreateTestInstance("AppWithDirectDependencyAndTypeBuild") .WithLockFiles(); var publishCommand = new PublishCommand(testInstance.TestRoot); var publishResult = publishCommand.Execute(); publishResult.Should().Pass(); var publishDir = publishCommand.GetOutputDirectory(portable: true); publishDir.Should().HaveFiles(new[] { // This one is directly referenced "xunit.core.dll" }); // But these are brought in only by the type:build dependency, and should not be published publishDir.Should().NotHaveFiles(new [] { "xunit.assert.dll" }); // Check the deps file var reader = new DependencyContextJsonReader(); DependencyContext context; using (var file = File.OpenRead(Path.Combine(publishDir.FullName, "AppWithDirectDependencyAndTypeBuild.deps.json"))) { context = reader.Read(file); } context.RuntimeLibraries.Should().NotContain(l => string.Equals(l.Name, "xunit.assert")); context.CompileLibraries.Should().NotContain(l => string.Equals(l.Name, "xunit.assert")); }
private DirectoryInfo Publish(TestInstance testInstance) { var publishCommand = new PublishCommand(Path.Combine(testInstance.TestRoot, "StandaloneApp")); var publishResult = publishCommand.Execute(); publishResult.Should().Pass(); return publishCommand.GetOutputDirectory(portable: false); }
public void ProjectWithContentsTest() { TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppWithContents") .WithLockFiles() .WithBuildArtifacts(); var testProject = _getProjectJson(instance.TestRoot, "TestAppWithContents"); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("testcontentfile.txt"); }
public void PublishTest(string appname, bool portable, bool checkCompilation) { var testProjectPath = Path.Combine(RepoRoot, "TestAssets", "TestProjects", "DependencyContextValidator", appname); var testProject = Path.Combine(testProjectPath, "project.json"); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); var exeName = portable ? publishCommand.GetPortableOutputName() : publishCommand.GetOutputExecutable(); var result = TestExecutable(publishCommand.GetOutputDirectory(portable).FullName, exeName, string.Empty); ValidateRuntimeLibraries(result, appname); if (checkCompilation) { ValidateCompilationLibraries(result, appname); } }
public void PortableAppWithIntentionalDowngradePublishesDowngradedManagedCode() { var testInstance = TestAssetsManager.CreateTestInstance("PortableTests") .WithLockFiles(); var publishCommand = new PublishCommand(Path.Combine(testInstance.TestRoot, "PortableAppWithIntentionalManagedDowngrade")); var publishResult = publishCommand.Execute(); publishResult.Should().Pass(); var publishDir = publishCommand.GetOutputDirectory(portable: true); publishDir.Should().HaveFiles(new[] { "PortableAppWithIntentionalManagedDowngrade.dll", "PortableAppWithIntentionalManagedDowngrade.deps.json", "System.Linq.dll" }); }
public async Task DesktopApp_WithDependencyOnNativePackage_ProducesExpectedOutput(string runtime, string expectedOutputName) { if (string.IsNullOrEmpty(expectedOutputName)) { expectedOutputName = $"the-win-{RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant()}-version.txt"; } var testInstance = _testAssetsManager.CreateTestInstance("DesktopAppWithNativeDep") .WithLockFiles(); var publishCommand = new PublishCommand(testInstance.TestRoot, runtime: runtime); var result = await publishCommand.ExecuteAsync(); result.Should().Pass(); // Test the output var outputDir = publishCommand.GetOutputDirectory(portable: false); outputDir.Should().HaveFile(expectedOutputName); outputDir.Should().HaveFile(publishCommand.GetOutputExecutable()); }
public async Task DesktopApp_WithKestrel_WorksWhenPublished(string project, string url, string runtime, string libuvName, bool forceRunnable) { var runnable = forceRunnable || string.IsNullOrEmpty(runtime) || (RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier().Contains(runtime)); var testInstance = GetTestInstance() .WithLockFiles(); // Prevent path too long failure on CI machines var projectPath = Path.Combine(testInstance.TestRoot, project); var publishCommand = new PublishCommand(projectPath, runtime: runtime, output: Path.Combine(projectPath, "out")); var result = await publishCommand.ExecuteAsync(); result.Should().Pass(); // Test the output var outputDir = publishCommand.GetOutputDirectory(portable: false); outputDir.Should().HaveFile(libuvName); outputDir.Should().HaveFile(publishCommand.GetOutputExecutable()); Task exec = null; if (runnable) { var outputExePath = Path.Combine(outputDir.FullName, publishCommand.GetOutputExecutable()); var command = new TestCommand(outputExePath); try { exec = command.ExecuteAsync(url); NetworkHelper.IsServerUp(url).Should().BeTrue($"Unable to connect to kestrel server - {project} @ {url}"); NetworkHelper.TestGetRequest(url, url); } finally { command.KillTree(); } if (exec != null) { await exec; } } }
public void PublishTestAppWithReferencesToResources() { var testInstance = TestAssetsManager.CreateTestInstance("ResourcesTests") .WithLockFiles(); var projectRoot = Path.Combine(testInstance.TestRoot, "TestApp"); var publishCommand = new PublishCommand(projectRoot); var publishResult = publishCommand.Execute(); publishResult.Should().Pass(); var publishDir = publishCommand.GetOutputDirectory(portable: true); publishDir.Should().HaveFiles(new[] { "TestApp.dll", "TestApp.deps.json" }); foreach (var culture in new[] { "de", "es", "fr", "it", "ja", "ko", "ru", "zh-Hans", "zh-Hant" }) { var cultureDir = publishDir.Sub(culture); // Provided by packages cultureDir.Should().HaveFiles(new[] { "Microsoft.Data.Edm.resources.dll", "Microsoft.Data.OData.resources.dll", "System.Spatial.resources.dll" }); // Check for the project-to-project one if (culture == "fr") { cultureDir.Should().HaveFile("TestLibraryWithResources.resources.dll"); } } }
public void StandaloneAppHasResourceDependency() { // WindowsAzure.Services brings in en, zh etc. resource DLLs. // The host has to be able to find these assemblies from the deps file // from the standalone app base under the ietf tag directory. var testName = "TestAppWithResourceDeps"; TestInstance instance = TestAssetsManager .CreateTestInstance(testName) .WithLockFiles() .WithBuildArtifacts(); var publishCommand = new PublishCommand(instance.TestRoot); publishCommand.Execute().Should().Pass(); var publishedDir = publishCommand.GetOutputDirectory(); var extension = publishCommand.GetExecutableExtension(); var outputExe = testName + extension; publishedDir.Should().HaveFiles(new[] { $"{testName}.dll", outputExe }); var command = new TestCommand(Path.Combine(publishedDir.FullName, outputExe)); command.Execute("").Should().ExitWith(0); }
public void LibraryPublishTest() { TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine("TestAppWithLibrary")) .WithLockFiles() .WithBuildArtifacts(); var testProject = _getProjectJson(instance.TestRoot, "TestLibrary"); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibrary.exe"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.pdb"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("System.Runtime.dll"); }
public void RefsPublishTest() { TestInstance instance = TestAssetsManager.CreateTestInstance("PortableTests") .WithLockFiles(); var publishCommand = new PublishCommand(Path.Combine(instance.TestRoot, "PortableAppCompilationContext")); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory(true).Should().HaveFile("PortableAppCompilationContext.dll"); var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory(true).FullName, "refs")); // Should have compilation time assemblies refsDirectory.Should().HaveFile("System.IO.dll"); // Libraries in which lib==ref should be deduped refsDirectory.Should().NotHaveFile("PortableAppCompilationContext.dll"); }
public void LibraryPublishTest() { // create unique directories in the 'temp' folder var root = Temp.CreateDirectory(); var testLibDir = root.CreateDirectory("TestLibrary"); //copy projects to the temp dir CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibrary"), testLibDir); var testProject = GetProjectPath(testLibDir); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibrary.exe"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.pdb"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("System.Runtime.dll"); }
public void TestLibraryBindingRedirectGeneration() { // Set up Test Staging in Temporary Directory var root = Temp.CreateDirectory(); root.CopyDirectory(Path.Combine(_testProjectsRoot, "TestBindingRedirectGeneration")); var testProjectsRootDir = Path.Combine(root.Path, "TestBindingRedirectGeneration"); var greaterTestLibDir = Path.Combine(testProjectsRootDir, "TestLibraryGreater"); var lesserTestLibDir = Path.Combine(testProjectsRootDir, "TestLibraryLesser"); var lesserTestProject = Path.Combine(lesserTestLibDir, "project.json"); var publishCommand = new PublishCommand(lesserTestProject, "net451"); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.pdb"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll.config"); publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibraryLesser.deps"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll"); publishCommand.GetOutputDirectory().Delete(true); publishCommand = new PublishCommand(lesserTestProject, "dnxcore50", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier()); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.pdb"); publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibraryLesser.dll.config"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.deps"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll"); }
public void TestLibraryPublishTest() { // create unique directories in the 'temp' folder var root = Temp.CreateDirectory(); root.CopyFile(Path.Combine(_testProjectsRoot, "global.json")); var testLibDir = root.CreateDirectory("TestLibraryWithRunner"); //copy projects to the temp dir CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibraryWithRunner"), testLibDir); RunRestore(testLibDir.Path); var testProject = GetProjectPath(testLibDir); var publishCommand = new PublishCommand(testProject, "net451"); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.pdb"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.deps"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.dll.config"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll"); publishCommand.GetOutputDirectory().Delete(true); publishCommand = new PublishCommand(testProject, "dnxcore50", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier()); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.pdb"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.deps"); publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibraryWithRunner.dll.config"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll"); }
public void PublishTestFullClr() { var testProjectPath = Path.Combine(RepoRoot, "TestAssets", "TestProjects", "DependencyContextValidator", "TestAppFullClr"); var testProject = Path.Combine(testProjectPath, "project.json"); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); var result = TestExecutable(publishCommand.GetOutputDirectory().FullName, publishCommand.GetOutputExecutable(), string.Empty); ValidateRuntimeLibrariesFullClr(result, "TestAppFullClr"); ValidateCompilationLibrariesFullClr(result, "TestAppFullClr"); }
public void RefsPublishTest() { TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppCompilationContext") .WithLockFiles() .WithBuildArtifacts(); var testProject = _getProjectJson(instance.TestRoot, "TestApp"); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestApp.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.dll"); var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory().FullName, "refs")); // Should have compilation time assemblies refsDirectory.Should().HaveFile("System.IO.dll"); // Libraries in which lib==ref should be deduped refsDirectory.Should().NotHaveFile("TestLibrary.dll"); }
public void CrossPublishingSucceedsAndHasExpectedArtifacts() { TestInstance instance = TestAssetsManager.CreateTestInstance(Path.Combine("PortableTests")); var testProject = Path.Combine(instance.TestRoot, "StandaloneApp", "project.json"); var workingDirectory = Path.GetDirectoryName(testProject); var testNugetCache = Path.Combine(workingDirectory, "packages_cross_publish_test"); var restoreCommand = new RestoreCommand(); restoreCommand.WorkingDirectory = workingDirectory; restoreCommand.Environment["NUGET_PACKAGES"] = testNugetCache; restoreCommand.Execute().Should().Pass(); foreach (var testData in CrossPublishTestData) { var buildCommand = new BuildCommand(testProject, runtime: testData.Rid); buildCommand.WorkingDirectory = Path.GetDirectoryName(testProject); buildCommand.Environment["NUGET_PACKAGES"] = testNugetCache; buildCommand.Execute().Should().Pass(); var publishCommand = new PublishCommand(testProject, runtime: testData.Rid, noBuild: true); publishCommand.Environment["NUGET_PACKAGES"] = testNugetCache; publishCommand.WorkingDirectory = Path.GetDirectoryName(testProject); publishCommand.Execute().Should().Pass(); var publishedDir = publishCommand.GetOutputDirectory(); publishedDir.Should().HaveFile("StandaloneApp"+ testData.HostExtension); foreach (var artifact in testData.ExpectedArtifacts) { publishedDir.Should().HaveFile(artifact); } } }
public async Task DesktopApp_WithRuntimes_PublishedSplitPackageAssets() { var testInstance = _testAssetsManager.CreateTestInstance("DesktopAppWithRuntimes") .WithLockFiles(); var publishCommand = new PublishCommand(testInstance.TestRoot, runtime: "win7-x64"); var result = await publishCommand.ExecuteAsync(); result.Should().Pass(); // Test the output var outputDir = publishCommand.GetOutputDirectory(portable: false); System.Console.WriteLine(outputDir); outputDir.Should().HaveFile("api-ms-win-core-file-l1-1-0.dll"); outputDir.Should().HaveFile(publishCommand.GetOutputExecutable()); }
public void RefsPublishTest() { // create unique directories in the 'temp' folder var root = Temp.CreateDirectory(); var testAppDir = root.CreateDirectory("TestAppCompilationContext"); var testLibDir = root.CreateDirectory("TestLibrary"); // copy projects to the temp dir CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestAppCompilationContext"), testAppDir); CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibrary"), testLibDir); var testProject = GetProjectPath(testAppDir); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestAppCompilationContext.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibrary.dll"); var refsDirectory = new DirectoryInfo(Path.Combine(publishCommand.GetOutputDirectory().FullName, "refs")); // Should have compilation time assemblies refsDirectory.Should().HaveFile("System.IO.dll"); // Libraries in which lib==ref should be deduped refsDirectory.Should().NotHaveFile("TestLibrary.dll"); }
public void ProjectWithPublishOptionsTest() { var instance = TestAssetsManager.CreateTestInstance("EndToEndTestApp") .WithLockFiles() .WithBuildArtifacts(); var testProject = _getProjectJson(instance.TestRoot, "EndToEndTestApp"); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("testpublishfile.txt"); publishCommand.GetOutputDirectory().Should().HaveFile("publishfiles/anotherpublishfile.txt"); }
public void TestLibraryPublishTest() { // create unique directories in the 'temp' folder var root = Temp.CreateDirectory(); var testLibDir = root.CreateDirectory("TestLibraryWithRunner"); //copy projects to the temp dir CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestLibraryWithRunner"), testLibDir); RunRestore(testLibDir.Path); var testProject = GetProjectPath(testLibDir); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.pdb"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.deps"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryWithRunner.dll.config"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll"); }
public void TestLibraryBindingRedirectGeneration() { TestInstance instance = TestAssetsManager.CreateTestInstance("TestBindingRedirectGeneration") .WithLockFiles() .WithBuildArtifacts(); var lesserTestProject = _getProjectJson(instance.TestRoot, "TestLibraryLesser"); var publishCommand = new PublishCommand(lesserTestProject, "net451"); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.exe"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.pdb"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.exe.config"); publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibraryLesser.deps.json"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll"); publishCommand.GetOutputDirectory().Delete(true); publishCommand = new PublishCommand(lesserTestProject, "netcoreapp1.0", RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier()); publishCommand.Execute().Should().Pass(); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.dll"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.pdb"); publishCommand.GetOutputDirectory().Should().NotHaveFile("TestLibraryLesser.dll.config"); publishCommand.GetOutputDirectory().Should().HaveFile("TestLibraryLesser.deps.json"); // dependencies should also be copied publishCommand.GetOutputDirectory().Should().HaveFile("Newtonsoft.Json.dll"); }
private static string Publish(string testRoot, bool isPortable) { string appName = Path.GetFileName(testRoot); var publishCmd = new PublishCommand(projectPath: testRoot, output: Path.Combine(testRoot, "bin")); var result = publishCmd.ExecuteWithCapturedOutput(); result.Should().Pass(); var publishDir = publishCmd.GetOutputDirectory(portable: isPortable).FullName; return Path.Combine(publishDir, appName + (isPortable ? ".dll" : FileNameSuffixes.CurrentPlatform.Exe)); }
public void PublishAppWithOutputAssemblyName() { TestInstance instance = TestAssetsManager .CreateTestInstance("AppWithOutputAssemblyName") .WithLockFiles() .WithBuildArtifacts(); var testRoot = _getProjectJson(instance.TestRoot, "AppWithOutputAssemblyName"); var publishCommand = new PublishCommand(testRoot, output: testRoot); publishCommand.Execute().Should().Pass(); var publishedDir = publishCommand.GetOutputDirectory(); var extension = publishCommand.GetExecutableExtension(); var outputExe = "MyApp" + extension; publishedDir.Should().HaveFiles(new[] { "MyApp.dll", outputExe }); publishedDir.Should().NotHaveFile("AppWithOutputAssemblyName" + extension); publishedDir.Should().NotHaveFile("AppWithOutputAssemblyName.dll"); var command = new TestCommand(Path.Combine(publishedDir.FullName, outputExe)); command.Execute("").Should().ExitWith(0); }
public void ProjectWithContentsTest() { // create unique directories in the 'temp' folder var testDir = Temp.CreateDirectory(); var testAppDir = Path.Combine(_testProjectsRoot, "TestAppWithContents"); // copy projects to the temp dir CopyProjectToTempDir(testAppDir, testDir); // run publish var testProject = GetProjectPath(testDir); var publishCommand = new PublishCommand(testProject); publishCommand.Execute().Should().Pass(); // make sure that the output dir has the content files publishCommand.GetOutputDirectory().Should().HaveFile("testcontentfile.txt"); }