internal void SaveAssemblyProj(MFAssembly asm) { if (!string.IsNullOrEmpty(asm.ProjectPath)) { string fullpath = ExpandEnvVars(asm.ProjectPath, ""); try { Project proj = LoadProject(fullpath); foreach (ProjectPropertyGroupElement bpg in proj.Xml.PropertyGroups) { foreach (ProjectPropertyElement bp in bpg.Properties) { switch(bp.Name) { case "Description": bp.Value = asm.Description; break; case "Groups": bp.Value = asm.Groups; break; } } } proj.Save(proj.FullPath); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error: saving asm file: " + fullpath + "\r\n", e.Message); } } }
internal MFAssembly LoadAssemblyProj(string asmProjFile, string path) { Project proj; string projname = Path.GetFileNameWithoutExtension(asmProjFile); string fullpath = ExpandEnvVars(asmProjFile, path); MFAssembly asm = m_helper.FindAssemblyByProject(fullpath); try { if (asm != null) return asm; if (!File.Exists(fullpath)) { // TODO: ERROR LOGGING return null; } asm = new MFAssembly(); asm.ProjectPath = ConvertPathToEnv(fullpath); proj = LoadProject(fullpath); path = Path.GetDirectoryName(fullpath); if (path.ToLower().Contains("\\framework\\tools\\")) return null; foreach (ProjectImportElement imp in proj.Xml.Imports) { // no server assemblies if (imp.Project.ToUpper().Contains("MICROSOFT.SPOT.CSHARP.HOST.TARGETS")) { return null; } } foreach (ProjectPropertyGroupElement pg in proj.Xml.PropertyGroups) { foreach (ProjectPropertyElement bp in pg.Properties) { switch (bp.Name) { case "AssemblyName": string asmName = bp.Value; asmName = asmName.Replace("$(MSBuildProjectName)", projname); asm.Name = asmName; asm.AssemblyFile = @"$(BUILD_TREE_CLIENT)\pe\" + asmName + ".pe"; break; case "TinyCLR_Platform": if (string.Compare(bp.Value, "Server", true) == 0) { // we don't want to process server tools for now return null; } break; case "ProjectGuid": asm.Guid = bp.Value; break; case "Groups": asm.Groups = bp.Value; break; } } } if (string.IsNullOrEmpty(asm.Name)) asm.Name = projname; if (string.IsNullOrEmpty(asm.Guid)) asm.Guid = System.Guid.NewGuid().ToString("B"); foreach (ProjectItemGroupElement big in proj.Xml.ItemGroups) { foreach (ProjectItemElement bi in big.Items) { string cond = CombineConditionals(big.Condition, bi.Condition); if (bi.ItemType == "Reference") { MFComponent asmRef = new MFComponent(MFComponentType.MFAssembly); asmRef.Name = bi.Include; asmRef.Conditional = cond; asm.References.Add(asmRef); } } } MFAssembly dbAsm = m_helper.FindAssemblyByName(asm.Name); if (null == dbAsm) { m_helper.DefaultInventory.Assemblies.Add(asm); } else { asm = dbAsm; } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error: loading assembly file: " + fullpath + "\r\n", e.Message); asm = null; } return asm; }
public void CopyTo(MFAssembly dest) { CopyHelper.CopyTo(this, dest); }