When copying the additional files to include, ncrunch trips when trying to copy a folder which name starts with a %-sign.
When trying to copy C:\sourcepath\%24name\%24name Analytics.item the following error is thrown.
System.IO.FileNotFoundException: Could not find file 'C:\sourcepath\24name Analytics.item'.
File name: 'C:\sourcepath\24name Analytics.item'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.GetAttributes(String path)
at nCrunch.Common.IO.FilePath.IsHidden()
at nCrunch.Common.IO.DirectoryPath.(String )
at nCrunch.Common.IO.DirectoryPath.ResolveFilesUsingExpression(String expression)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(List`1 , List`1 , DirectoryPath , List`1 )
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(String[] )
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)
Is there a way I can convince ncrunch to copy these files?
Thanks for posting this and bringing it to our attention!
We currently can't handle two % markers in one path. They are parsed as an environment variable. (ie. %APPDATA%) As a work around, could you perhaps add the files to the project? Or change the directory name?
Unfortunately I cannot include the files to the project, nor change the directory name.
It would be nice to see an option where you could exclude some of the files or folder from the copy action like with the /EXCLUDE on xcopy.
I was not able to add a line to the Additional Files To Include setting with an environment variable in it. Is it possible to set a line using an environment variable in the Additional Files To Include setting?
If not, is it valid to interpret double %-sign as an environment variable in a string that cannot contain such a variable?
MartijnBosRHM wrote:
I was not able to add a line to the Additional Files To Include setting with an environment variable in it. Is it possible to set a line using an environment variable in the Additional Files To Include setting?
If not, is it valid to interpret double %-sign as an environment variable in a string that cannot contain such a variable?
In theory, yes, this could work.
When NCrunch parses the path for the % symbol, it will only make one pass of the string. This means that if you have an environment variable with a name that matches its value, you could make the algorithm do a null substitution.
The condition here would be that you'd need to have an environment variable for every directory containing the %. It's possible that this will only work when two percentage values are involved...
Ah I see what you mean. This would be a shakey solution in my opinion, but could work when there are not to many directories with a percentage sign that contain a file with a percentage sign.
What I meant was that I could not get a path with a environment variable in the Additional FIles To Include setting to begin with. So if I can't get a environment variable in there, why try to replace it?
MartijnBosRHM wrote:Ah I see what you mean. This would be a shakey solution in my opinion, but could work when there are not to many directories with a percentage sign that contain a file with a percentage sign.
Yes, it absolutely is. This is a defect in NCrunch and it will be fixed with a code fix in the next version. The focus right now is on finding a way to get you working until then.
MartijnBosRHM wrote:
What I meant was that I could not get a path with a environment variable in the Additional FIles To Include setting to begin with. So if I can't get a environment variable in there, why try to replace it?
The code responsible for swapping out the environment variables is handled very generically within NCrunch, and as such is applied to all file paths that can be fed into it. In this case, when the feature was added it was targeted to other areas of the software and its application to Additional Files To Include was incidental. Unfortunately, it looks like the UI for specifying the additional files wasn't updated to handle it. In theory this could be worked around by specifying the values yourself using a text editor in the config file directly.