private void LoadAssets() { AppDll = Path.Combine(Location, $"{AssemblyName}.dll"); AppExe = Path.Combine(Location, RuntimeInformationExtensions.GetExeFileNameForCurrentPlatform(AssemblyName)); DepsJson = Path.Combine(Location, $"{AssemblyName}.deps.json"); RuntimeConfigJson = Path.Combine(Location, $"{AssemblyName}.runtimeconfig.json"); RuntimeDevConfigJson = Path.Combine(Location, $"{AssemblyName}.runtimeconfig.dev.json"); HostPolicyDll = Path.Combine(Location, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostpolicy")); HostFxrDll = Path.Combine(Location, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostfxr")); }
public TestProjectFixture( string testProjectName, RepoDirectoriesProvider repoDirectoriesProvider, string exeExtension = null, string sharedLibraryExtension = null, string sharedLibraryPrefix = null, string testProjectSourceDirectory = null, string testArtifactDirectory = null, string dotnetInstallPath = null, string currentRid = null, string builtDotnetOutputPath = null, string framework = null, string assemblyName = null) { ValidateRequiredDirectories(repoDirectoriesProvider); _testProjectName = testProjectName; _framework = framework ?? Environment.GetEnvironmentVariable("MNA_TFM"); _exeExtension = exeExtension ?? RuntimeInformationExtensions.GetExeExtensionForCurrentOSPlatform(); _sharedLibraryExtension = sharedLibraryExtension ?? RuntimeInformationExtensions.GetSharedLibraryExtensionForCurrentPlatform(); _sharedLibraryPrefix = sharedLibraryPrefix ?? RuntimeInformationExtensions.GetSharedLibraryPrefixForCurrentPlatform(); _repoDirectoriesProvider = repoDirectoriesProvider; _testProjectSourceDirectory = testProjectSourceDirectory ?? Path.Combine(repoDirectoriesProvider.RepoRoot, "src", "test", "Assets", "TestProjects"); _testArtifactDirectory = _testArtifactDirectory ?? Environment.GetEnvironmentVariable(s_testArtifactDirectoryEnvironmentVariable) ?? Path.Combine(AppContext.BaseDirectory, s_testArtifactDirectoryEnvironmentVariable); _sdkDotnet = new DotNetCli(dotnetInstallPath ?? repoDirectoriesProvider.DotnetSDK); _currentRid = currentRid ?? repoDirectoriesProvider.TargetRID; _builtDotnet = new DotNetCli(repoDirectoriesProvider.BuiltDotnet); _assemblyName = assemblyName; InitializeTestProject( _testProjectName, _testProjectSourceDirectory, _testArtifactDirectory, _exeExtension, _sharedLibraryExtension, _sharedLibraryPrefix, _assemblyName); }
/// <summary> /// Add a mock of the Microsoft.NETCore.App framework with the specified version /// </summary> /// <param name="version">Version to add</param> /// <remarks> /// Product runtime binaries are not added. All the added mock framework will contain is a mock version of host policy. /// </remarks> public DotNetBuilder AddMicrosoftNETCoreAppFrameworkMockHostPolicy(string version) { // ./shared/Microsoft.NETCore.App/<version> - create a mock of the root framework string netCoreAppPath = Path.Combine(_path, "shared", "Microsoft.NETCore.App", version); Directory.CreateDirectory(netCoreAppPath); // ./shared/Microsoft.NETCore.App/<version>/hostpolicy.dll - this is a mock, will not actually load CoreCLR string mockHostPolicyFileName = RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("mockhostpolicy"); File.Copy( Path.Combine(_repoDirectories.Artifacts, "corehost_test", mockHostPolicyFileName), Path.Combine(netCoreAppPath, RuntimeInformationExtensions.GetSharedLibraryFileNameForCurrentPlatform("hostpolicy")), true); return(this); }
public DotNetBuilder(string basePath, string builtDotnet, string name) { _path = name == null ? basePath : Path.Combine(basePath, name); Directory.CreateDirectory(_path); _repoDirectories = new RepoDirectoriesProvider(builtDotnet: _path); // Prepare the dotnet installation mock // ./dotnet.exe - used as a convenient way to load and invoke hostfxr. May change in the future to use test-specific executable var builtDotNetCli = new DotNetCli(builtDotnet); File.Copy( builtDotNetCli.DotnetExecutablePath, Path.Combine(_path, RuntimeInformationExtensions.GetExeFileNameForCurrentPlatform("dotnet")), true); // ./host/fxr/<version>/hostfxr.dll - this is the component being tested SharedFramework.CopyDirectory( builtDotNetCli.GreatestVersionHostFxrPath, Path.Combine(_path, "host", "fxr", Path.GetFileName(builtDotNetCli.GreatestVersionHostFxrPath))); }