public static string GetPathToDotNetFrameworkFile(string fileName, TargetDotNetFrameworkVersion version) { string dir = GetPathToDotNetFramework(version); string file = Path.Combine(dir, fileName); if (File.Exists(file)) { return(file); } //Mono doesn't ship multiple versions of tools that are backwards/forwards compatible if (!runningOnDotNet) { #if NET_3_5 //most of the 3.5 tools are in the 2.0 directory if (version == TargetDotNetFrameworkVersion.Version35) { return(GetPathToDotNetFrameworkFile(fileName, TargetDotNetFrameworkVersion.Version20)); } #endif //unversioned tools are in the 4.5 directory if (version == TargetDotNetFrameworkVersion.Version20) { return(GetPathToDotNetFrameworkFile(fileName, (TargetDotNetFrameworkVersion)5)); } } return(null); }
public static string TryGetTeamCityMsbuildLoggerParam(TargetDotNetFrameworkVersion version, TeamCityProperties tc = null) { tc = tc ?? new TeamCityProperties(); if (!tc.IsRunningInTeamCity) { return(null); } // Differs by MSBuild version if (version < TargetDotNetFrameworkVersion.Version20) { return(null); } string prop = version >= TargetDotNetFrameworkVersion.Version40 ? "teamcity.dotnet.msbuild.extensions4.0" : "teamcity.dotnet.msbuild.extensions2.0"; // Read path from TC config var pathDll = new FileSystemPath(tc.GetConfigurationProperty(prop)); if (!pathDll.ExistsFile) { throw new InvalidOperationException("There's the TeamCity MSBuild logger path, but it does not exist on disk."); } // Make the path string sClassName = "JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger"; return(sClassName + "," + pathDll.FullPath + ";"); }
public static string GetPathToDotNetFrameworkReferenceAssemblies(TargetDotNetFrameworkVersion version) { switch (version) { case TargetDotNetFrameworkVersion.Version11: return(FrameworkLocationHelper.PathToDotNetFrameworkV11); case TargetDotNetFrameworkVersion.Version20: return(FrameworkLocationHelper.PathToDotNetFrameworkV20); case TargetDotNetFrameworkVersion.Version30: return(FrameworkLocationHelper.PathToDotNetFrameworkReferenceAssembliesV30); case TargetDotNetFrameworkVersion.Version35: return(FrameworkLocationHelper.PathToDotNetFrameworkReferenceAssembliesV35); case TargetDotNetFrameworkVersion.Version40: if (dotnet40ReferenceAssemblyPath == null) { string path = GenerateReferenceAssemblyPath(FrameworkLocationHelper.programFilesReferenceAssemblyLocation, dotNetFourFrameworkName); if (Directory.Exists(path)) { dotnet40ReferenceAssemblyPath = path; dotnet40ReferenceAssemblyPath = FileUtilities.EnsureTrailingSlash(dotnet40ReferenceAssemblyPath); } } return(dotnet40ReferenceAssemblyPath); } ErrorUtilities.VerifyThrowArgument(false, "ToolLocationHelper.UnsupportedFrameworkVersion", version.ToString()); return(null); }
internal static string GetPathToDotNetFrameworkSdkFile(string fileName, TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture, bool canFallBackIfNecessary) { string pathToDotNetFrameworkSdk = GetPathToDotNetFrameworkSdk(version); string str2 = null; if (pathToDotNetFrameworkSdk != null) { pathToDotNetFrameworkSdk = Path.Combine(pathToDotNetFrameworkSdk, "bin"); if (version == TargetDotNetFrameworkVersion.Version40) { pathToDotNetFrameworkSdk = Path.Combine(pathToDotNetFrameworkSdk, "NETFX 4.0 Tools"); } string processorArchitecture = ConvertDotNetFrameworkArchitectureToProcessorArchitecture(architecture); str2 = GetPathToDotNetFrameworkSdkFile(fileName, pathToDotNetFrameworkSdk, processorArchitecture); if ((str2 != null) || !canFallBackIfNecessary) { return(str2); } if (!string.Equals(ProcessorArchitecture.CurrentProcessArchitecture, processorArchitecture, StringComparison.OrdinalIgnoreCase)) { str2 = GetPathToDotNetFrameworkSdkFile(fileName, pathToDotNetFrameworkSdk, ProcessorArchitecture.CurrentProcessArchitecture); } if ((str2 == null) && !string.Equals("x86", ProcessorArchitecture.CurrentProcessArchitecture, StringComparison.OrdinalIgnoreCase)) { str2 = GetPathToDotNetFrameworkSdkFile(fileName, pathToDotNetFrameworkSdk, "x86"); } } return(str2); }
public static string GetPathToDotNetFrameworkFile(string fileName, TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture) { string pathToDotNetFramework = GetPathToDotNetFramework(version, architecture); if (pathToDotNetFramework == null) { return(null); } return(Path.Combine(pathToDotNetFramework, fileName)); }
public IEnumerable <string> EnumerateNUnitReferences(string nunitBasePath, TargetDotNetFrameworkVersion frameworkVersion) { if (nunitBasePath == null) { throw new ArgumentNullException(nameof(nunitBasePath)); } if (GetNUnitFrameworkPath(nunitBasePath, frameworkVersion, "nunit.framework.dll", out var path)) { yield return(path); } }
public IEnumerable <string> EnumerateNUnitAssemblies(string nunitBasePath, TargetDotNetFrameworkVersion frameworkVersion) { yield return(GetNUnitFrameworkPath(nunitBasePath, frameworkVersion, "nunit.framework.dll")); var file = GetNUnitFrameworkPath(nunitBasePath, frameworkVersion, "NUnit.System.Linq.dll"); if (file != null) { yield return(file); } }
private static RedistList GetFrameworkListFromReferenceAssembliesPath(TargetDotNetFrameworkVersion version) { string pathToDotNetFrameworkReferenceAssemblies = ToolLocationHelper.GetPathToDotNetFrameworkReferenceAssemblies(version); string[] strArray = (pathToDotNetFrameworkReferenceAssemblies == null) ? new string[0] : GetRedistListPathsFromDisk(pathToDotNetFrameworkReferenceAssemblies); AssemblyTableInfo[] assemblyTables = new AssemblyTableInfo[strArray.Length]; for (int i = 0; i < strArray.Length; i++) { assemblyTables[i] = new AssemblyTableInfo(strArray[i], pathToDotNetFrameworkReferenceAssemblies); } return(GetRedistList(assemblyTables)); }
public static bool TryParseVersion(string version, out TargetDotNetFrameworkVersion frameworkVersion) { if (string.IsNullOrWhiteSpace(version)) { throw new ArgumentNullException(nameof(version)); } version = version.ToLower().Replace("v", string.Empty).Replace(".", string.Empty); if (version.Length > 2) { version = version.Substring(0, 2); } switch (version) { case "1": case "10": case "11": frameworkVersion = TargetDotNetFrameworkVersion.Version11; return(true); case "2": case "20": frameworkVersion = TargetDotNetFrameworkVersion.Version20; return(true); case "3": case "30": frameworkVersion = TargetDotNetFrameworkVersion.Version30; return(true); case "35": frameworkVersion = TargetDotNetFrameworkVersion.Version35; return(true); case "4": case "40": frameworkVersion = TargetDotNetFrameworkVersion.Version40; return(true); case "45": case "46": case "47": case "48": frameworkVersion = TargetDotNetFrameworkVersion.Version45; return(true); } frameworkVersion = TargetDotNetFrameworkVersion.VersionLatest; return(false); }
private static string GetMachineConfigPathFromTargetFrameworkMoniker(string moniker) { TargetDotNetFrameworkVersion targetFrameworkVersionEnumFromMoniker = GetTargetFrameworkVersionEnumFromMoniker(moniker); if (targetFrameworkVersionEnumFromMoniker == TargetDotNetFrameworkVersion.Version40) { return(null); } string pathToDotNetFrameworkFile = ToolLocationHelper.GetPathToDotNetFrameworkFile(@"config\machine.config", targetFrameworkVersionEnumFromMoniker); new FileIOPermission(FileIOPermissionAccess.PathDiscovery, pathToDotNetFrameworkFile).Demand(); return(pathToDotNetFrameworkFile); }
public static string GetPathToDotNetFramework(TargetDotNetFrameworkVersion version, Microsoft.Build.Utilities.DotNetFrameworkArchitecture architecture) { Version version2 = null; switch (version) { case TargetDotNetFrameworkVersion.Version11: version2 = dotNetFrameworkVersion11; break; case TargetDotNetFrameworkVersion.Version20: version2 = dotNetFrameworkVersion20; break; case TargetDotNetFrameworkVersion.Version30: version2 = dotNetFrameworkVersion30; break; case TargetDotNetFrameworkVersion.Version35: version2 = dotNetFrameworkVersion35; break; case TargetDotNetFrameworkVersion.Version40: version2 = dotNetFrameworkVersion40; break; default: ErrorUtilities.VerifyThrowArgument(false, "ToolLocationHelper.UnsupportedFrameworkVersion", version.ToString()); return(null); } Microsoft.Build.Shared.DotNetFrameworkArchitecture current = Microsoft.Build.Shared.DotNetFrameworkArchitecture.Current; switch (architecture) { case Microsoft.Build.Utilities.DotNetFrameworkArchitecture.Current: current = Microsoft.Build.Shared.DotNetFrameworkArchitecture.Current; break; case Microsoft.Build.Utilities.DotNetFrameworkArchitecture.Bitness32: current = Microsoft.Build.Shared.DotNetFrameworkArchitecture.Bitness32; break; case Microsoft.Build.Utilities.DotNetFrameworkArchitecture.Bitness64: current = Microsoft.Build.Shared.DotNetFrameworkArchitecture.Bitness64; break; default: ErrorUtilities.ThrowInternalErrorUnreachable(); return(null); } return(FrameworkLocationHelper.GetPathToDotNetFramework(version2, current)); }
public static string GetPathToDotNetFramework(TargetDotNetFrameworkVersion version) { if (version == TargetDotNetFrameworkVersion.Version11) { return(mono_1_0_dir); } else if (version == TargetDotNetFrameworkVersion.Version20) { return(mono_2_0_dir); } else { throw new ArgumentException("version"); } }
public static string GetDotNetFrameworkSdkRootRegistryKey(TargetDotNetFrameworkVersion version) { switch (version) { case TargetDotNetFrameworkVersion.Version11: case TargetDotNetFrameworkVersion.Version20: return(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework"); case TargetDotNetFrameworkVersion.Version35: return(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A"); case TargetDotNetFrameworkVersion.Version40: return(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A"); } ErrorUtilities.VerifyThrowArgument(false, "ToolLocationHelper.UnsupportedFrameworkVersion", version.ToString()); return(null); }
private bool GetNUnitFrameworkPath(string nunitBasePath, TargetDotNetFrameworkVersion frameworkVersion, string fileName, out string path) { if (nunitBasePath == null) { throw new ArgumentNullException(nameof(nunitBasePath)); } if (fileName == null) { throw new ArgumentNullException(nameof(fileName)); } var pathPatterns = new List <string>(); switch (frameworkVersion) { case TargetDotNetFrameworkVersion.Version45: pathPatterns.Add("net*4*5"); pathPatterns.Add("net45"); break; case TargetDotNetFrameworkVersion.Version40: pathPatterns.Add("net*4*0"); pathPatterns.Add("net40"); break; case TargetDotNetFrameworkVersion.Version20: pathPatterns.Add("net*2*0"); pathPatterns.Add("net20"); break; default: throw new NotSupportedException(frameworkVersion.ToString()); } foreach (var pathPattern in pathPatterns) { if (TryFindFolder(nunitBasePath, pathPattern, fileName, out path)) { return(true); } } path = default(string); return(false); }
static void Main(string[] args) { string assemblyPath = args[0]; FileInfo assemblyFile = new FileInfo(assemblyPath); string assemblyFileName = assemblyFile.Name; Directory.SetCurrentDirectory(assemblyFile.Directory.FullName); string ilName = "ilcode.il"; TargetDotNetFrameworkVersion sdkVersion = TargetDotNetFrameworkVersion.VersionLatest; string ildasmPath = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile("ildasm.exe", sdkVersion); /* Где-то это работает, у меня нет */ string ilasmPath = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile("ilasm.exe", sdkVersion); /* В какой-то библиотеке используется такой "хак" */ if (string.IsNullOrEmpty(ilasmPath)) { ilasmPath = @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe"; } string ildasmArgs = string.Format("/out={0} {1}", ilName, assemblyFileName); string ilasmArgs = string.Format("/out={0} {1}", assemblyFileName, ilName); ProcessStartInfo ildasmStart = new ProcessStartInfo(ildasmPath, ildasmArgs); ildasmStart.WindowStyle = ProcessWindowStyle.Hidden; ProcessStartInfo ilasmStart = new ProcessStartInfo(ilasmPath, ilasmArgs); ilasmStart.WindowStyle = ProcessWindowStyle.Hidden; Process p; p = Process.Start(ildasmStart); p.WaitForExit(); string ilCode = File.ReadAllText(ilName); string ilModified = ilCode.Replace("Hello, World!", "Goodbye, World!"); File.WriteAllText(ilName, ilModified); p = Process.Start(ilasmStart); p.WaitForExit(); }
public static string GetPathToDotNetFrameworkSdk(TargetDotNetFrameworkVersion version) { switch (version) { case TargetDotNetFrameworkVersion.Version11: return(FrameworkLocationHelper.PathToDotNetFrameworkSdkV11); case TargetDotNetFrameworkVersion.Version20: return(FrameworkLocationHelper.PathToDotNetFrameworkSdkV20); case TargetDotNetFrameworkVersion.Version35: return(FrameworkLocationHelper.PathToDotNetFrameworkSdkV35); case TargetDotNetFrameworkVersion.Version40: return(FrameworkLocationHelper.PathToDotNetFrameworkSdkV40); } ErrorUtilities.VerifyThrowArgument(false, "ToolLocationHelper.UnsupportedFrameworkVersion", version.ToString()); return(null); }
private static string VersionToString(TargetDotNetFrameworkVersion version) { switch (version) { case TargetDotNetFrameworkVersion.Version11: return("v1.1"); case TargetDotNetFrameworkVersion.Version20: return("v2"); case TargetDotNetFrameworkVersion.Version30: return("v2"); case TargetDotNetFrameworkVersion.Version35: return("v2"); case TargetDotNetFrameworkVersion.Version40: return("v4"); case TargetDotNetFrameworkVersion.Version45: return("v4"); default: return("v4"); } }
public static string GetDotNetFrameworkSdkInstallKeyValue(TargetDotNetFrameworkVersion version) { switch (version) { case TargetDotNetFrameworkVersion.Version11: return("SDKInstallRootv1.1"); case TargetDotNetFrameworkVersion.Version20: return("SDKInstallRootv2.0"); case TargetDotNetFrameworkVersion.Version35: return("InstallationFolder"); case TargetDotNetFrameworkVersion.Version40: return("InstallationFolder"); } ErrorUtilities.VerifyThrowArgument(false, "ToolLocationHelper.UnsupportedFrameworkVersion", version.ToString()); return(null); }
private FrameworkName GetTargetFrameworkName(TargetDotNetFrameworkVersion version) { switch (version) { case TargetDotNetFrameworkVersion.Version11: return(new FrameworkName(".NET Framework, Version=1.1")); case TargetDotNetFrameworkVersion.Version20: return(new FrameworkName(".NET Framework, Version=2.0")); case TargetDotNetFrameworkVersion.Version30: return(new FrameworkName(".NET Framework, Version=3.0")); case TargetDotNetFrameworkVersion.Version35: return(new FrameworkName(".NET Framework, Version=3.5")); default: return(new FrameworkName(".NET Framework, Version=4.0")); } }
/// <summary> /// Finds location of given version of given assembly. /// </summary> /// <param name="assemblyName">Name of the assembly to find.</param> /// <param name="version">Version of framework to use.</param> /// <returns>Absolute path to referenced assembly.</returns> public static string GetLocation(string assemblyName, string version) { if (!assemblyName.EndsWith(".dll")) { assemblyName += ".dll"; } // Try to find a different version, if current one does not exist. int currentVersionIndex = (Versions as IList <string>).IndexOf(version); for (int i = currentVersionIndex; i >= 0; i--) { TargetDotNetFrameworkVersion versionId = TargetFrameworkVersionMap[Versions[i]]; string path = Path.Combine(ToolLocationHelper.GetPathToDotNetFramework(versionId), VersionsShort[i], assemblyName); if (File.Exists(path)) { return(path); } } return(assemblyName); }
public static string GetFrameworkPath(this Project project) { var targetPlatform = project.ConfigurationManager.ActiveConfiguration.Properties.Item("PlatformTarget").Value as string; int targetFramework = Convert.ToInt32(project.Properties.Item("TargetFramework").Value); TargetDotNetFrameworkVersion version = TargetDotNetFrameworkVersion.Version40; switch (targetFramework) { case Fx40: version = TargetDotNetFrameworkVersion.Version40; break; case Fx35: version = TargetDotNetFrameworkVersion.Version35; break; case Fx30: version = TargetDotNetFrameworkVersion.Version30; break; case Fx20: version = TargetDotNetFrameworkVersion.Version20; break; } DotNetFrameworkArchitecture arch = DotNetFrameworkArchitecture.Bitness32; if (targetPlatform == "AnyCpu") { arch = DotNetFrameworkArchitecture.Current; } if (targetPlatform == "x64") { arch = DotNetFrameworkArchitecture.Bitness64; } return(ToolLocationHelper.GetPathToDotNetFramework(version, arch)); }
public static string GetDotNetFrameworkVersionFolderPrefix(TargetDotNetFrameworkVersion version) { switch (version) { case TargetDotNetFrameworkVersion.Version11: return("v1.1"); case TargetDotNetFrameworkVersion.Version20: return("v2.0"); case TargetDotNetFrameworkVersion.Version30: return("v3.0"); case TargetDotNetFrameworkVersion.Version35: return("v3.5"); case TargetDotNetFrameworkVersion.Version40: return("v4.0"); } ErrorUtilities.VerifyThrowArgument(false, "ToolLocationHelper.UnsupportedFrameworkVersion", version.ToString()); return(null); }
public static string TryGetTeamCityMsbuildLoggerParam(TargetDotNetFrameworkVersion version, TeamCityProperties tc = null) { tc = tc ?? new TeamCityProperties(); if(!tc.IsRunningInTeamCity) return null; // Differs by MSBuild version if(version < TargetDotNetFrameworkVersion.Version20) return null; string prop = version >= TargetDotNetFrameworkVersion.Version40 ? "teamcity.dotnet.msbuild.extensions4.0" : "teamcity.dotnet.msbuild.extensions2.0"; // Read path from TC config var pathDll = new FileSystemPath(tc.GetConfigurationProperty(prop)); if(!pathDll.ExistsFile) throw new InvalidOperationException("There's the TeamCity MSBuild logger path, but it does not exist on disk."); // Make the path string sClassName = "JetBrains.BuildServer.MSBuildLoggers.MSBuildLogger"; return sClassName + "," + pathDll.FullPath + ";"; }
public void Compile(TestAssembly testAssembly, string assemblyFileName, TargetDotNetFrameworkVersion dotNetFrameworkVersion) { var architecture = DotNetFrameworkArchitecture.Current; switch (testAssembly.Platform) { case Platform.X86: architecture = DotNetFrameworkArchitecture.Bitness32; break; case Platform.X64: architecture = DotNetFrameworkArchitecture.Bitness32; break; } var assemblyInfoSyntaxTree = CSharpSyntaxTree.ParseText(ResourceManager.GetContentFromResource(AssemblyInfoResourceName) + Environment.NewLine + string.Join(Environment.NewLine, testAssembly.Attributes)); var compilation = CSharpCompilation.Create(Path.GetFileName(assemblyFileName)) .WithOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) .WithPlatform(testAssembly.Platform) .WithOptimizationLevel(OptimizationLevel.Debug)) .AddReferences(GetDotNetFrameworkReferences(dotNetFrameworkVersion, architecture)) .AddReferences(testAssembly.References.Select(assembly => MetadataReference.CreateFromFile(assembly))) .AddSyntaxTrees(assemblyInfoSyntaxTree) .AddSyntaxTrees(UtilsSyntaxTree) .AddSyntaxTrees(testAssembly.Classes.Select(CreateClassSyntaxTree)); using (var file = new FileStream(assemblyFileName, FileMode.Create)) { var result = compilation.Emit(file); if (!result.Success) { var code = string.Join(Environment.NewLine + Environment.NewLine, compilation.SyntaxTrees.Select(i => i.ToString())); throw new Exception($"Errors:\n{string.Join(Environment.NewLine, result.Diagnostics.Select(i => i.GetMessage(CultureInfo.InvariantCulture)))}\n\nCode:\n{code}"); } file.Flush(true); } }
public static Microsoft.Build.BuildEngine.Engine CreateMSEngine(NAnt.VSNet.Tasks.SolutionTask solutionTask) { if (_msbuild != null) { return(_msbuild); } // map current target framework to TargetDotNetFrameworkVersion TargetDotNetFrameworkVersion frameworkVersion = GetTargetDotNetFrameworkVersion( solutionTask.Project.TargetFramework); // use the framework directory as BinPath string frameworkDir = ToolLocationHelper.GetPathToDotNetFramework( frameworkVersion); _msbuild = new Microsoft.Build.BuildEngine.Engine(frameworkDir); _msbuild.UnregisterAllLoggers(); _msbuild.RegisterLogger( new NAntLogger(solutionTask, solutionTask.Verbose ? Microsoft.Build.Framework.LoggerVerbosity.Normal : Microsoft.Build.Framework.LoggerVerbosity.Minimal ) ); /* * foreach (PropertyTask property in solutionTask.CustomProperties) { * string val; * // expand properties in context of current project for non-dynamic properties * if (!property.Dynamic) { * val = solutionTask.Project.ExpandProperties(property.Value, solutionTask.Location); * } * else * val = property.Value; * _msbuild.GlobalProperties.SetProperty(property.PropertyName, val); * } */ return(_msbuild); }
private string GetNUnitFrameworkPath(string nunitBasePath, TargetDotNetFrameworkVersion frameworkVersion, string fileName) { string pathPattern; switch (frameworkVersion) { case TargetDotNetFrameworkVersion.Version45: pathPattern = "net*4*5"; break; case TargetDotNetFrameworkVersion.Version40: pathPattern = "net*4*0"; break; case TargetDotNetFrameworkVersion.Version20: pathPattern = "net*2*0"; break; default: throw new NotSupportedException(frameworkVersion.ToString()); } return(FindFolder(nunitBasePath, pathPattern, fileName)); }
public static string GetPathToDotNetFrameworkFile (string fileName, TargetDotNetFrameworkVersion version) { string dir = GetPathToDotNetFramework (version); string file = Path.Combine (dir, fileName); if (File.Exists (file)) return file; //Mono doesn't ship multiple versions of tools that are backwards/forwards compatible if (!runningOnDotNet) { #if NET_3_5 //most of the 3.5 tools are in the 2.0 directory if (version == TargetDotNetFrameworkVersion.Version35) return GetPathToDotNetFrameworkFile (fileName, TargetDotNetFrameworkVersion.Version20); #endif //unversioned tools are in the 4.5 directory if (version == TargetDotNetFrameworkVersion.Version20) return GetPathToDotNetFrameworkFile (fileName, (TargetDotNetFrameworkVersion)5); } return null; }
public static string GetPathToDotNetFramework (TargetDotNetFrameworkVersion version) { return mono_dir [(int)version]; }
/// <summary> /// Return a path to the .net framework if the boolean property said we should return one. /// Return null if we should not fake the fact that the framework is installed /// </summary> internal string GetDotNetFramework(TargetDotNetFrameworkVersion version) { if (version == TargetDotNetFrameworkVersion.Version20) { if (DotNet20Installed) { return DotNet20FrameworkPath; } else { return null; } } if (version == TargetDotNetFrameworkVersion.Version30) { if (DotNet30Installed) { return DotNet30FrameworkPath; } else { return null; } } if (version == TargetDotNetFrameworkVersion.Version35) { if (DotNet35Installed) { return DotNet35FrameworkPath; } else { return null; } } if (version == TargetDotNetFrameworkVersion.Version40) { if (DotNet40Installed) { return DotNet40FrameworkPath; } else { return null; } } return null; }
/// <summary> /// Execute sn.exe. /// </summary> /// <param name="targetDotNetFrameworkVersion">The target .NET Framework version.</param> /// <param name="strongNameDotExePathArguments">The arguments to supply.</param> private static void ExecuteSNDotExe(TargetDotNetFrameworkVersion targetDotNetFrameworkVersion, string strongNameDotExePathArguments) { string strongNameDotExePath = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(SNDotExeName, targetDotNetFrameworkVersion); ProcessStartInfo processStartInfo = new ProcessStartInfo(strongNameDotExePath, strongNameDotExePathArguments); processStartInfo.CreateNoWindow = true; processStartInfo.RedirectStandardError = true; processStartInfo.RedirectStandardOutput = true; processStartInfo.UseShellExecute = false; Process process = Process.Start(processStartInfo); string standardOutput = process.StandardOutput.ReadToEnd(); string standardError = process.StandardError.ReadToEnd(); process.WaitForExit(); Console.WriteLine(standardOutput); if (process.ExitCode != 0) { Console.WriteLine(standardError); } }
public static string GetPathToDotNetFrameworkSdkFile(string fileName, TargetDotNetFrameworkVersion version) { throw new NotImplementedException(); }
public static string GetPathToDotNetFramework(TargetDotNetFrameworkVersion version) { return(mono_dir [(int)version]); }
// Methods public static string GetDotNetFrameworkVersionFolderPrefix(TargetDotNetFrameworkVersion version) { }
public static string GetPathToDotNetFramework(TargetDotNetFrameworkVersion version) { }
public static string GetPathToDotNetFrameworkSdkFile(string fileName, TargetDotNetFrameworkVersion version) { }
/// <summary> /// Try to get the path to the tool in the Windows SDK with the given .NET Framework version and /// of the same architecture as we were currently given for TargetProcessorArchitecture. /// </summary> private string GetPathToSDKFileWithCurrentlyTargetedArchitecture(string file, TargetDotNetFrameworkVersion targetFrameworkVersion, VisualStudioVersion visualStudioVersion) { string path = null; switch (this.TargetProcessorArchitecture) { case UtilitiesProcessorArchitecture.ARM: case UtilitiesProcessorArchitecture.X86: path = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, visualStudioVersion, DotNetFrameworkArchitecture.Bitness32); break; case UtilitiesProcessorArchitecture.AMD64: case UtilitiesProcessorArchitecture.IA64: path = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, visualStudioVersion, DotNetFrameworkArchitecture.Bitness64); break; case UtilitiesProcessorArchitecture.MSIL: default: // just go with the default lookup break; } if (path == null) { // fall back to the default lookup (current architecture / x86) just in case it's found there ... path = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, visualStudioVersion); } return path; }
public static string GetPathToDotNetFrameworkSdk (TargetDotNetFrameworkVersion version) { return GetPathToDotNetFramework (version); }
public static string GetPathToDotNetFrameworkSdkFile (string fileName, TargetDotNetFrameworkVersion version) { throw new NotImplementedException (); }
private string GetPathToSDKFileWithCurrentlyTargetedArchitecture(string file, TargetDotNetFrameworkVersion targetFrameworkVersion) { string pathToDotNetFrameworkSdkFile = null; string targetProcessorArchitecture = this.TargetProcessorArchitecture; if (targetProcessorArchitecture != null) { if (!(targetProcessorArchitecture == "x86")) { if ((targetProcessorArchitecture == "AMD64") || (targetProcessorArchitecture == "IA64")) { pathToDotNetFrameworkSdkFile = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, Microsoft.Build.Utilities.DotNetFrameworkArchitecture.Bitness64); } else if (targetProcessorArchitecture == "MSIL") { } } else { pathToDotNetFrameworkSdkFile = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion, Microsoft.Build.Utilities.DotNetFrameworkArchitecture.Bitness32); } } if (pathToDotNetFrameworkSdkFile == null) { pathToDotNetFrameworkSdkFile = ToolLocationHelper.GetPathToDotNetFrameworkSdkFile(file, targetFrameworkVersion); } return pathToDotNetFrameworkSdkFile; }
public static string GetPathToDotNetFrameworkSdk(TargetDotNetFrameworkVersion version) { return(GetPathToDotNetFramework(version)); }
public static string GetPathToDotNetFramework(TargetDotNetFrameworkVersion version) { return(ToolLocationHelper.GetPathToDotNetFramework(version)); }
public static string GetDotNetFrameworkSdkInstallKeyValue(TargetDotNetFrameworkVersion version) { }
public static string GetDotNetFrameworkRootRegistryKey(TargetDotNetFrameworkVersion version) { }
public static string GetPathToDotNetFramework(TargetDotNetFrameworkVersion version, DotNetFrameworkArchitecture architecture) { return(ToolLocationHelper.GetPathToDotNetFramework(version, architecture)); }
public static string GetDotNetFrameworkRootRegistryKey (TargetDotNetFrameworkVersion version) { throw new NotImplementedException (); }
/// <summary> /// Return a path to the .net framework reference assemblies if the boolean property said we should return one. /// Return null if we should not fake the fact that the framework reference assemblies are installed /// </summary> internal string GetDotNetFrameworkReferenceAssemblies(TargetDotNetFrameworkVersion version) { if (version == TargetDotNetFrameworkVersion.Version40) { if (DotNetReferenceAssemblies40Installed) { return DotNet40ReferenceAssemblyPath; } else { return null; } } if (version == TargetDotNetFrameworkVersion.Version35) { if (DotNetReferenceAssemblies35Installed) { return DotNet35ReferenceAssemblyPath; } else { return null; } } if (version == TargetDotNetFrameworkVersion.Version30) { if (DotNetReferenceAssemblies30Installed) { return DotNet30ReferenceAssemblyPath; } else { return null; } } return null; }
public static string GetDotNetFrameworkSdkInstallKeyValue (TargetDotNetFrameworkVersion version) { throw new NotImplementedException (); }
/// <summary> /// Generate an Strong Name Key pair. /// </summary> /// <param name="targetDotNetFrameworkVersion">The target .NET Framework version.</param> /// <param name="strongNameKeyPairPath">The path to the Strong Name Key pair.</param> public static void GenerateKeyPair(TargetDotNetFrameworkVersion targetDotNetFrameworkVersion, string strongNameKeyPairPath) { string args = string.Format(CultureInfo.CurrentCulture, "-k \"{0}\"", strongNameKeyPairPath); ExecuteSNDotExe(targetDotNetFrameworkVersion, args); }
public static string GetDotNetFrameworkVersionFolderPrefix (TargetDotNetFrameworkVersion version) { throw new NotImplementedException (); }