Closed nlz242 closed 11 years ago
Hi, could you please provide me an example vbp file. Unfortunately I did not use any ResFile32 in my former vp6 projects. It could be minimal only with required entries and a single class or form.
Yes sure. I made a minimal project for you. I shared it on google as it seems github doesn't support attached files other than images. https://docs.google.com/file/d/0BzIf7wgxyO9AdzMxV1lYWVZMNmc/edit The zip contains 3 files, a form, a vbp and a res file. You will see that NAntContrib's VB6 task will build it the first time (as it's not finding the build output) just fine, but the second time, when it starts to look if references and such changed, it'll crash because of the line #4 of the vbp : ResFile32="strings.res" If you remove the double quotes so that it becomes : ResFile32=strings.res It will build just fine, but as soon as you open the .vbp with the VB6 IDE, it'll add the double-quotes again.
Hi, I checked the code and I would like to suggest using Trim()
instead of Replace()
since this is used at ExeName32
and Name
below. I think this fix could be done in this way:
sources.Includes.Add(keyValue.Trim('"'));
Just for info, vb6.exe updates vbp file after build especially if you have auto increment enabled for version numbers. This might result in showing this quotes again.
I added the fix. I did the smallest thing to get this working. Any thoughts?
Makes sense to me. The only question I would have is that if there was anyway to add a test for this but given that it is vb6 based, I don't have any hopes for it.
I thought of adding a test, but this requires either larger changes in code or a rather complex test setup. So I skiped it for vb6 task
Yeah, don't stress about it then. I'm not even sure we can find a vb6 compiler to use for testing anyway. Good to go.
Then let's go
When using tasks, the first build works well, however any builds after that fails with the following exception.
Build Error: NAnt.Core.BuildException Error creating FileSet. at NAnt.Core.Types.FileSet.Scan() at NAnt.Core.Types.FileSet.get_FileNames() at NAnt.Contrib.Tasks.Vb6Task.ProjectNeedsCompiling(String projectFile) at NAnt.Contrib.Tasks.Vb6Task.NeedsCompiling() at NAnt.Contrib.Tasks.Vb6Task.ExecuteTask() at NAnt.Core.Task.Execute() at NAnt.Core.Target.Execute() at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies) at NAnt.Core.Project.Execute() at NAnt.Core.Project.Run()
After adding some logging to both NAnt and NAntContrib, i found out that if my project (.vbp) contains an ResFile32 entry, it is automatically decorated with double-quotes. The ParseProjectFile() function inside of Vb6Task isn't aware of that and it returns this entry still decorated with the double-quotes. So it fails when it gets to line 371 : "fileName = FileSet.FindMoreRecentLastWriteTime(references.FileNames, outputFileInfo.LastWriteTime);"
Because references.FileNames gets called with a list that contains many valid entries, but one that is decorated with double-quotes.
Stack trace from within NAnt looks like this : Error creating FileSet. ---> System.ArgumentException: Illegal characters in path. at System.IO.Path.CheckInvalidPathChars(String path) at System.IO.Path.Combine(String path1, String path2) at NAnt.Core.DirectoryScanner.CleanPath(String baseDirectory, String nantPath) at NAnt.Core.DirectoryScanner.ParseSearchDirectoryAndPattern(Boolean isInclude, String originalNAntPattern, String& searchDirectory, Boolean& recursive, Boolean& isRegex, String& regexPattern) at NAnt.Core.DirectoryScanner.ConvertPatterns(StringCollection nantPatterns, ArrayList regexPatterns, StringCollection nonRegexFiles, Boolean addSearchDirectories) at NAnt.Core.DirectoryScanner.Scan() at NAnt.Core.Types.FileSet.Scan() --- End of inner exception stack trace --- at NAnt.Core.Types.FileSet.Scan() at NAnt.Core.Types.FileSet.get_FileNames() at NAnt.Contrib.Tasks.Vb6Task.ProjectNeedsCompiling(String projectFile) at NAnt.Contrib.Tasks.Vb6Task.NeedsCompiling() at NAnt.Contrib.Tasks.Vb6Task.ExecuteTask() at NAnt.Core.Task.Execute() at NAnt.Core.Target.Execute() at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies) at NAnt.Core.Project.Execute() at NAnt.Core.Project.Run()
To temporary fix this issue in my build environement, i replaced line 519 of Vb6Task.cs with: sources.Includes.Add(keyValue.Replace("\"","")); This removes any double-quotes, which are not part of any valid filename anyways. This doesn't seem like a proper long-term fix, but it's good enough for me in the short-term.
One thing i tried, to confirm that this isnt an issue with my single .vbp file, is i edited the vbp outside from a text editor to remove the double-quotes around the ResFiles32 entry, saved the file, opened it in the VB6 IDE, did absolutely no changes, closed the IDE. It asked if i wanted to save the .vbp file (suspicious...), i did save it and reopened the vbp in the text editor. As i tought, the double-quotes are back.
Hopefully this issue submission is detailled enough, should you want a sample .vbp file with the issue, i can provide one.