Exemplo n.º 1
0
        private void MakeCompilationOutputRunnableForCoreCLR()
        {
            WriteDepsFileAndCopyProjectDependencies(_exporter);

            // TODO: Pick a host based on the RID
            CoreHost.CopyTo(_runtimeOutputPath, _context.ProjectFile.Name + Constants.ExeSuffix);
        }
Exemplo n.º 2
0
        private void MakeCompilationOutputRunnableForCoreCLR(string outputPath, LibraryExporter exporter)
        {
            WriteDepsFileAndCopyProjectDependencies(exporter, _context.ProjectFile.Name, outputPath);

            // TODO: Pick a host based on the RID
            CoreHost.CopyTo(outputPath, _context.ProjectFile.Name + Constants.ExeSuffix);
        }
Exemplo n.º 3
0
        private void MakeCompilationOutputRunnableForCoreCLR()
        {
            WriteDepsFileAndCopyProjectDependencies(_exporter);

            var emitEntryPoint = _compilerOptions.EmitEntryPoint ?? false;

            if (emitEntryPoint && !string.IsNullOrEmpty(_context.RuntimeIdentifier))
            {
                // TODO: Pick a host based on the RID
                CoreHost.CopyTo(_runtimeOutputPath, _compilerOptions.OutputName + Constants.ExeSuffix);
            }
        }
Exemplo n.º 4
0
        private static int RenamePublishedHost(ProjectContext context, string outputPath, CommonCompilerOptions compilationOptions)
        {
            if (context.TargetFramework.IsDesktop())
            {
                return(0);
            }

            var publishedHostFile = ResolvePublishedHostFile(outputPath);

            if (publishedHostFile == null)
            {
                Reporter.Output.WriteLine($"publish: warning: host executable not available in dependencies, using host for current platform");
                // TODO should this be an error?

                CoreHost.CopyTo(outputPath, compilationOptions.OutputName + Constants.ExeSuffix);
                return(0);
            }

            var publishedHostExtension = Path.GetExtension(publishedHostFile);
            var renamedHostName        = compilationOptions.OutputName + publishedHostExtension;
            var renamedHostFile        = Path.Combine(outputPath, renamedHostName);

            try
            {
                Reporter.Verbose.WriteLine($"publish: renaming published host {publishedHostFile} to {renamedHostFile}");
                File.Copy(publishedHostFile, renamedHostFile, true);
                File.Delete(publishedHostFile);
            }
            catch (Exception e)
            {
                Reporter.Error.WriteLine($"publish: Failed to rename {publishedHostFile} to {renamedHostFile}: {e.Message}");
                return(1);
            }

            return(0);
        }