本文整理汇总了C#中MonoDevelop.Core.Assemblies.TargetRuntime类的典型用法代码示例。如果您正苦于以下问题:C# TargetRuntime类的具体用法?C# TargetRuntime怎么用?C# TargetRuntime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TargetRuntime类属于MonoDevelop.Core.Assemblies命名空间,在下文中一共展示了TargetRuntime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
internal void Initialize ()
{
CreateFrameworks ();
runtimes = new List<TargetRuntime> ();
foreach (ITargetRuntimeFactory factory in AddinManager.GetExtensionObjects ("/MonoDevelop/Core/Runtimes", typeof(ITargetRuntimeFactory))) {
foreach (TargetRuntime runtime in factory.CreateRuntimes ()) {
runtimes.Add (runtime);
if (runtime.IsRunning)
DefaultRuntime = CurrentRuntime = runtime;
}
}
// Don't initialize until Current and Default Runtimes are set
foreach (TargetRuntime runtime in runtimes) {
runtime.Initialized += HandleRuntimeInitialized;
}
if (CurrentRuntime == null)
LoggingService.LogFatalError ("Could not create runtime info for current runtime");
CurrentRuntime.StartInitialization ();
LoadUserAssemblyContext ();
userAssemblyContext.Changed += delegate {
SaveUserAssemblyContext ();
};
}
示例2: CanDebugRuntime
public static bool CanDebugRuntime (TargetRuntime runtime)
{
var mrun = runtime as MonoTargetRuntime;
if (mrun == null)
return false;
return mrun.AssemblyContext.GetAssemblyLocation ("Mono.Debugger.Soft", null) != null;
}
示例3: MonoMacExecutionCommand
public MonoMacExecutionCommand (TargetRuntime runtime, TargetFramework framework, FilePath appPath,
FilePath launchScript, bool debugMode)
{
this.AppPath = appPath;
this.LaunchScript = launchScript;
this.Framework = framework;
this.Runtime = runtime;
this.DebugMode = debugMode;
}
示例4: MonoDroidExecutionCommand
public MonoDroidExecutionCommand (string packageName, FilePath apkPath,
TargetRuntime runtime, TargetFramework framework, bool debugMode)
{
this.PackageName = packageName;
this.ApkPath = apkPath;
this.Runtime = runtime;
this.Framework = framework;
this.DebugMode = debugMode;
DebugPort = MonoDroidSettings.DebuggerPort;
OutputPort = MonoDroidSettings.DebuggerOutputPort;
}
示例5: GetSystemWebDom
static ICompilation GetSystemWebDom (TargetRuntime runtime, TargetFramework targetFramework)
{
string file = runtime.AssemblyContext.GetAssemblyNameForVersion (sysWebAssemblyName, targetFramework);
if (string.IsNullOrEmpty (file))
throw new Exception ("System.Web assembly name not found for framework " + targetFramework.Id);
file = runtime.AssemblyContext.GetAssemblyLocation (file, targetFramework);
if (string.IsNullOrEmpty (file))
throw new Exception ("System.Web assembly file not found for framework " + targetFramework.Id);
var dom = new SimpleCompilation (TypeSystemService.LoadAssemblyContext (runtime, targetFramework, file));
if (dom == null)
throw new Exception ("System.Web parse database not found for framework " + targetFramework.Id + " file '" + file + "'");
return dom;
}
示例6: IPhoneExecutionCommand
public IPhoneExecutionCommand (TargetRuntime runtime, TargetFramework framework, FilePath appPath,
FilePath logDirectory, bool debugMode, IPhoneSimulatorTarget target,
IPhoneSdkVersion minimumOSVersion, TargetDevice supportedDevices)
{
this.AppPath = appPath;
this.LogDirectory = logDirectory;
this.Framework = framework;
this.Runtime = runtime;
this.DebugMode = debugMode;
this.SimulatorTarget = target;
this.MinimumOSVersion = minimumOSVersion;
this.SupportedDevices = supportedDevices;
}
示例7: GetSystemWebDom
static ProjectDom GetSystemWebDom (TargetRuntime runtime, TargetFramework targetFramework)
{
string file = runtime.AssemblyContext.GetAssemblyNameForVersion (sysWebAssemblyName, targetFramework);
if (string.IsNullOrEmpty (file))
throw new Exception ("System.Web assembly name not found for framework " + targetFramework.Id);
file = runtime.AssemblyContext.GetAssemblyLocation (file, targetFramework);
if (string.IsNullOrEmpty (file))
throw new Exception ("System.Web assembly file not found for framework " + targetFramework.Id);
ProjectDom dom = ProjectDomService.GetAssemblyDom (runtime, file);
if (dom == null)
throw new Exception ("System.Web parse database not found for framework " + targetFramework.Id + " file '" + file + "'");
return dom;
}
示例8: Initialize
protected override void Initialize (TargetRuntime runtime, TargetFramework framework)
{
base.Initialize (runtime, framework);
fxVersion = GetFxVersion (framework);
foreach (var dir in GetMoonDirectories ()) {
var fxdir = dir.Combine (fxVersion);
var buildVersion = fxdir.Combine ("buildversion");
if (Directory.Exists (fxdir) && Directory.Exists (fxdir + "-redist") && File.Exists (buildVersion)) {
if (LoadVersionString (buildVersion) && RegisterRedistAssemblies (dir))
this.location = dir;
break;
}
}
}
示例9: Initialize
protected override void Initialize (TargetRuntime runtime, TargetFramework framework)
{
if (framework.Id.Identifier != "Silverlight")
throw new InvalidOperationException (string.Format ("Cannot handle unknown framework {0}", framework.Id));
base.Initialize (runtime, framework);
fxVersion = framework.Id.Version;
foreach (var dir in GetMoonDirectories ()) {
var fxdir = dir.Combine (fxVersion);
var buildVersion = fxdir.Combine ("buildversion");
if (Directory.Exists (fxdir) && Directory.Exists (fxdir + "-redist") && File.Exists (buildVersion)) {
if (LoadVersionString (buildVersion) && RegisterRedistAssemblies (dir))
this.location = dir;
break;
}
}
}
示例10: GetCompilerName
static string GetCompilerName(TargetRuntime runtime, TargetFramework fx)
{
string fsc = runtime.GetToolPath (fx, "fsc");
if (fsc != null) {
return fsc;}
else {
string message = GettextCatalog.GetString ("F# compiler not found for {0}.", fx.Name);
LoggingService.LogError (message);
throw new Exception (message);
}
}
示例11: Initialize
internal protected virtual void Initialize (TargetRuntime runtime, TargetFramework framework)
{
this.runtime = runtime;
this.framework = framework;
}
示例12: GetProjectBuilder
internal static async Task<RemoteProjectBuilder> GetProjectBuilder (TargetRuntime runtime, string minToolsVersion, string file, string solutionFile, int customId, bool lockBuilder = false)
{
using (await buildersLock.EnterAsync ())
{
//attempt to use 14.0 builder first if available
string toolsVersion = "14.0";
string binDir = runtime.GetMSBuildBinPath ("14.0");
if (binDir == null) {
toolsVersion = "12.0";
binDir = runtime.GetMSBuildBinPath ("12.0");
if (binDir == null) {
//fall back to 4.0, we know it's always available
toolsVersion = "4.0";
}
}
// Check the ToolsVersion we found can handle the project
// The check is only done for the .NET framework since Mono doesn't really have the concept of ToolsVersion.
// On Mono we'll just try to build with whatever is installed.
Version tv, mtv;
if (runtime is MsNetTargetRuntime && Version.TryParse (toolsVersion, out tv) && Version.TryParse (minToolsVersion, out mtv) && tv < mtv) {
string error = null;
if (minToolsVersion == "12.0")
error = "MSBuild 2013 is not installed. Please download and install it from " +
"http://www.microsoft.com/en-us/download/details.aspx?id=40760";
throw new InvalidOperationException (error ?? string.Format (
"Runtime '{0}' does not have MSBuild '{1}' ToolsVersion installed",
runtime.Id, toolsVersion)
);
}
//one builder per solution
string builderKey = runtime.Id + " # " + solutionFile + " # " + customId;
RemoteBuildEngine builder = null;
if (lockBuilder) {
foreach (var b in builders.GetBuilders (builderKey)) {
if (b.Lock ()) {
builder = b;
break;
}
b.Unlock ();
}
} else
builder = builders.GetBuilders (builderKey).FirstOrDefault ();
if (builder != null) {
builder.ReferenceCount++;
return new RemoteProjectBuilder (file, builder);
}
return await Task.Run (() => {
//always start the remote process explicitly, even if it's using the current runtime and fx
//else it won't pick up the assembly redirects from the builder exe
var exe = GetExeLocation (runtime, toolsVersion);
MonoDevelop.Core.Execution.RemotingService.RegisterRemotingChannel ();
var pinfo = new ProcessStartInfo (exe) {
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardInput = true,
};
runtime.GetToolsExecutionEnvironment ().MergeTo (pinfo);
Process p = null;
try {
IBuildEngine engine;
if (!runLocal) {
p = runtime.ExecuteAssembly (pinfo);
// The builder app will write the build engine reference
// after reading the process id from the standard input
ManualResetEvent ev = new ManualResetEvent (false);
string responseKey = "[MonoDevelop]";
string sref = null;
p.ErrorDataReceived += (sender, e) => {
if (e.Data == null) {
if (string.IsNullOrEmpty (sref))
LoggingService.LogError ("The MSBuild builder exited before initializing");
return;
}
if (e.Data.StartsWith (responseKey, StringComparison.Ordinal)) {
sref = e.Data.Substring (responseKey.Length);
ev.Set ();
} else
Console.WriteLine (e.Data);
};
p.BeginErrorReadLine ();
p.StandardInput.WriteLine (Process.GetCurrentProcess ().Id.ToString ());
if (!ev.WaitOne (TimeSpan.FromSeconds (5)))
throw new Exception ("MSBuild process could not be started");
byte [] data = Convert.FromBase64String (sref);
MemoryStream ms = new MemoryStream (data);
BinaryFormatter bf = new BinaryFormatter ();
engine = (IBuildEngine)bf.Deserialize (ms);
//.........这里部分代码省略.........
示例13: GetNewestInstalledToolsVersion
static string GetNewestInstalledToolsVersion (TargetRuntime runtime, bool requiresMicrosoftBuild, out string binDir)
{
string [] supportedToolsVersions;
if ((requiresMicrosoftBuild || Runtime.Preferences.BuildWithMSBuild) && !Platform.IsWindows)
supportedToolsVersions = new [] { "15.0"};
else
supportedToolsVersions = new [] { "14.0", "12.0", "4.0" };
foreach (var toolsVersion in supportedToolsVersions) {
binDir = runtime.GetMSBuildBinPath (toolsVersion);
if (binDir != null) {
return toolsVersion;
}
}
throw new Exception ("Did not find MSBuild for runtime " + runtime.Id);
}
示例14: ParseAssemblyUri
public static bool ParseAssemblyUri (string uri, out TargetRuntime runtime, out TargetFramework fx, out string file)
{
if (uri.StartsWith (assemblyPrefix)) {
runtime = null;
fx = null;
int curOffset = assemblyPrefix.Length;
int i = uri.IndexOf (':', curOffset);
if (i != -1) {
string rid = uri.Substring (assemblyPrefix.Length, i - assemblyPrefix.Length);
runtime = Runtime.SystemAssemblyService.GetTargetRuntime (rid);
curOffset = i + 1;
}
i = Math.Max (uri.IndexOfAny (separators, curOffset), curOffset);
if (uri[i - 1] == ':' && i == curOffset + 2)
i = curOffset;
file = uri.Substring (i);
if (runtime == null)
runtime = Runtime.SystemAssemblyService.DefaultRuntime;
if (fx == null)
fx = TargetFramework.Default;
return true;
}
file = null;
runtime = null;
fx = null;
return false;
}
示例15: LoadAssembly
public static string LoadAssembly (TargetRuntime runtime, string file)
{
string name = "Assembly:" + runtime.Id + ":" + Path.GetFullPath (file);
if (GetDom (name, true) != null)
return name;
else
return null;
}