public MsbuildIntegrationTestFixture()
        {
            _cliDirectory = TestDotnetCLiUtility.CopyAndPatchLatestDotnetCli();
            var dotnetExecutableName = RuntimeEnvironmentHelper.IsWindows ? "dotnet.exe" : "dotnet";

            TestDotnetCli = Path.Combine(_cliDirectory, dotnetExecutableName);

            var sdkPath = Directory.EnumerateDirectories(Path.Combine(_cliDirectory, "sdk"))
                          .Where(d => !string.Equals(Path.GetFileName(d), "NuGetFallbackFolder", StringComparison.OrdinalIgnoreCase))
                          .Single();

            MsBuildSdksPath = Path.Combine(sdkPath, "Sdks");

            _templateDirectory = new SimpleTestPathContext();
            TestDotnetCLiUtility.WriteGlobalJson(_templateDirectory.WorkingDirectory);

            // some project templates use implicit packages. For example, class libraries targeting netstandard2.0
            // will have an implicit package reference for NETStandard.Library, and its dependencies.
            // .NET Core SDK 3.0 and later no longer ship these packages in a NuGetFallbackFolder. Therefore, we need
            // to be able to download these packages. We'll download it once into the template cache's global packages
            // folder, and then use that as a local source for individual tests, to minimise network access.
            var addSourceArgs = new AddSourceArgs()
            {
                Configfile = _templateDirectory.NuGetConfig,
                Name       = "nuget.org",
                Source     = "https://api.nuget.org/v3/index.json"
            };

            AddSourceRunner.Run(addSourceArgs, () => NullLogger.Instance);

            _processEnvVars.Add("MSBuildSDKsPath", MsBuildSdksPath);
            _processEnvVars.Add("UseSharedCompilation", "false");
            _processEnvVars.Add("DOTNET_MULTILEVEL_LOOKUP", "0");
            _processEnvVars.Add("MSBUILDDISABLENODEREUSE ", "true");
        }
Пример #2
0
        public CrossVerifyTestFixture()
        {
#if IS_DESKTOP
            var patchedCliFolder = TestDotnetCLiUtility.CopyAndPatchLatestDotnetCli(sdkVersion: SdkVersion, sdkTfm: SdkTfm);
            _dotnetExePath = Path.Combine(patchedCliFolder, DotnetExe);
#else
            var nugetExeFolder = TestFileSystemUtility.GetNuGetExeDirectoryInRepo();
            _nugetExePath = Path.Combine(nugetExeFolder, NuGetExe);
#endif
            _testServer = new Lazy <Task <SigningTestServer> >(SigningTestServer.CreateAsync);
            _defaultTrustedCertificateAuthority = new Lazy <Task <CertificateAuthority> >(CreateDefaultTrustedCertificateAuthorityAsync);
            _defaultTrustedTimestampService     = new Lazy <Task <TimestampService> >(CreateDefaultTrustedTimestampServiceAsync);
            _responders = new DisposableList <IDisposable>();
            _defaultAuthorSigningCertficate     = new Lazy <Task <X509Certificate2> >(CreateDefaultAuthorSigningCertificateAsync);
            _defaultRepositorySigningCertficate = new Lazy <Task <X509Certificate2> >(CreateDefaultRepositorySigningCertificateAsync);
        }