Hi, locking problems occurs only to assemblies bigger than 64kB. Do you test it with larger assemblies?
here is some link to microsoft support: http://support.microsoft.com/default.aspx?scid=kb;en-us;313512 Martin ----- Original Message ----- From: "Ivan Tarasov" <[EMAIL PROTECTED]> To: "Martin Aliger" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, December 02, 2003 12:39 PM Subject: Re[2]: [nant-dev] project references problems in <solution> task > Hello Martin, > > MA> you are right - this is problem in current setup. I was also point to that, > MA> but there are some problems how to find references to assembly without lock > MA> them. Current framework sometimes locks assemblies when you load them (even > MA> into another appdomain). VS2003 has also problem with it [cannot copy > MA> because another process use this file error] > > MA> If you have some another method how to find those references, send it here! > MA> [possible also as path to reference.cs] > > Thanks for the quick response, I didn't know about that problem with > framework. I'm not sure if it is really a problem, since in almost all > cases assemblies should not be written to more than once (I mean their > creation time). > > In VS2003 I've had some locking problems when using my GUI component > located in another project and this project was in current solution > and the main project depended on it. In that case, the GUI component > needs to be built first, but when it is being copied to the directory > to which main project references, it fails. After some investigation I > understood that Windows.Forms designer locks the .dll, thus I have to > unload project which uses the component before building it. Probably, > this is the case you are describing (or some variation of it). > > So, here is the patch. I'm quite new to .NET (3 months of experience > in it), and I still cannot find needed classes which I want to use. > So, please excuse me for using linear search in ArrayList instead of > using some kind of "set" class (as it could do in C++). > > I've tested it on my projects and it worked (and I've still had no > problems with locking), so I'm pretty sure it is better than copying > all the files from the given directory. > > ------- Patch to Reference.cs, from nightly build (28.11.03) ------- > 23a24 > > using System.Collections; > 265c266 > < foreach (string referenceFile in Directory.GetFiles(fi.DirectoryName, "*.dll")) { > --- > > foreach (string referenceFile in GetAllReferencedModules(_referenceFile)) { > 283d283 > < > 309a310,336 > > > > private string[] GetAllReferencedModules(string module) { > > string fullPathToModule = Path.GetFullPath(module); > > string moduleDirectory = Path.GetDirectoryName(fullPathToModule); > > > > ArrayList referenceList = new ArrayList(); > > referenceList.Add(fullPathToModule); > > > > for (int currentModule = 0; currentModule < referenceList.Count; currentModule++) { > > AppendReferencedModulesLocatedInGivenDirectory(moduleDirectory, (string) referenceList[currentModule], referenceList); > > } > > > > return (string[]) referenceList.ToArray(typeof(string)); > > } > > > > private void AppendReferencedModulesLocatedInGivenDirectory(string moduleDirectory, > > string moduleName, ArrayList referenceList) { > > Assembly module = Assembly.LoadFrom(moduleName); > > AssemblyName[] referencedAssemblies = module.GetReferencedAssemblies(); > > > > foreach (AssemblyName referencedAssemblyName in referencedAssemblies) { > > string fullPathToReferencedAssembly = string.Format(@"{0}\{1}.dll", moduleDirectory, referencedAssemblyName.Name); > > // we only add referenced assemblies which are located in given directory > > if (File.Exists(fullPathToReferencedAssembly) && !referenceList.Contains(fullPathToReferencedAssembly)) > > referenceList.Add(fullPathToReferencedAssembly); > > } > > } > ------------------------ End of Patch ----------------------------- > > -- > Best regards, > Ivan mailto:[EMAIL PROTECTED] > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > nant-developers mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-developers > ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
