private static (VBRuntime, string[]) GetExpectedOutputs(string targetFramework, bool isExe) { switch ((targetFramework, isExe)) { case ("net45", true): var files = new[] { "HelloWorld.exe", "HelloWorld.exe.config", "HelloWorld.pdb" }; if (TestProject.ReferenceAssembliesAreInstalled(TargetDotNetFrameworkVersion.Version471)) { return(VBRuntime.Default, files); } else { return(VBRuntime.Referenced, files); } case ("netcoreapp2.1", true): return(VBRuntime.Embedded, new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.runtimeconfig.json", "HelloWorld.runtimeconfig.dev.json", "HelloWorld.deps.json", }); case ("netcoreapp3.0", true): return(VBRuntime.Referenced, AssertionHelper.AppendApphostOnNonMacOS("HelloWorld", new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.runtimeconfig.json", "HelloWorld.runtimeconfig.dev.json", "HelloWorld.deps.json", })); case ("netcoreapp3.0", false): return(VBRuntime.Referenced, new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.deps.json", }); case ("netstandard2.0", false): return(VBRuntime.Embedded, new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.deps.json", }); default: throw new ArgumentOutOfRangeException(); } }
public void It_does_not_copy_local_package_dependencies_when_requested_not_to() { const string ProjectName = "TestProjWithPackageDependencies"; TestProject testProject = new TestProject() { Name = ProjectName, TargetFrameworks = "netcoreapp3.0", IsExe = true }; testProject.AdditionalProperties["CopyLocalLockFileAssemblies"] = "false"; testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "11.0.2")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); var testProjectInstance = _testAssetsManager .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); buildCommand.Execute().Should().Pass(); var outputDirectory = buildCommand.GetOutputDirectory(testProject.TargetFrameworks); outputDirectory.Should().OnlyHaveFiles(AssertionHelper.AppendApphostOnNonMacOS(ProjectName, new[] { $"{ProjectName}.deps.json", $"{ProjectName}.dll", $"{ProjectName}.pdb", $"{ProjectName}.runtimeconfig.dev.json", $"{ProjectName}.runtimeconfig.json", })); }
private static (VBRuntime, string[]) GetExpectedOutputs(string targetFramework, bool isExe) { switch ((targetFramework, isExe)) { case ("net45", true): return(VBRuntime.Default, new[] { "HelloWorld.exe", "HelloWorld.exe.config", "HelloWorld.pdb" }); case ("netcoreapp2.1", true): return(VBRuntime.Embedded, new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.runtimeconfig.json", "HelloWorld.runtimeconfig.dev.json", "HelloWorld.deps.json", }); case ("netcoreapp3.0", true): return(VBRuntime.Referenced, AssertionHelper.AppendApphostOnNonMacOS("HelloWorld", new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.runtimeconfig.json", "HelloWorld.runtimeconfig.dev.json", "HelloWorld.deps.json", })); case ("netcoreapp3.0", false): return(VBRuntime.Referenced, new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.deps.json", }); case ("netstandard2.0", false): return(VBRuntime.Embedded, new[] { "HelloWorld.dll", "HelloWorld.pdb", "HelloWorld.deps.json", }); default: throw new ArgumentOutOfRangeException(); } }
public void ItPublishesFrameworkDependentWithoutRid(string args) { var testAppName = "MSBuildTestApp"; var outputDirectory = PublishApp(testAppName, rid: null, args: args); outputDirectory.Should().OnlyHaveFiles(AssertionHelper.AppendApphostOnNonMacOS(testAppName, new[] { $"{testAppName}.dll", $"{testAppName}.pdb", $"{testAppName}.deps.json", $"{testAppName}.runtimeconfig.json", })); new DotnetCommand(Log) .Execute(Path.Combine(outputDirectory.FullName, $"{testAppName}.dll")) .Should().Pass() .And.HaveStdOutContaining("Hello World"); }
public void It_copies_local_package_dependencies_on_build() { const string ProjectName = "TestProjWithPackageDependencies"; TestProject testProject = new TestProject() { Name = ProjectName, IsSdkProject = true, TargetFrameworks = "netcoreapp3.0", IsExe = true }; testProject.PackageReferences.Add(new TestPackageReference("Newtonsoft.Json", "11.0.2")); testProject.PackageReferences.Add(new TestPackageReference("sqlite", "3.13.0")); var testProjectInstance = _testAssetsManager .CreateTestProject(testProject); var buildCommand = new BuildCommand(testProjectInstance); buildCommand.Execute() .Should() .Pass(); var outputDirectory = buildCommand.GetOutputDirectory(testProject.TargetFrameworks); var expectedFiles = new [] { $"{ProjectName}.deps.json", $"{ProjectName}.dll", $"{ProjectName}.pdb", $"{ProjectName}.runtimeconfig.dev.json", $"{ProjectName}.runtimeconfig.json", "Newtonsoft.Json.dll", "runtimes/linux-x64/native/libsqlite3.so", "runtimes/osx-x64/native/libsqlite3.dylib", "runtimes/win7-x64/native/sqlite3.dll", "runtimes/win7-x86/native/sqlite3.dll" }; outputDirectory.Should().OnlyHaveFiles(AssertionHelper.AppendApphostOnNonMacOS(ProjectName, expectedFiles)); }