示例#1
0
        private static string ResolveTargetPath(IProjectSystem projectSystem,
                                                IDictionary <string, IPackageFileTransformer> fileTransformers,
                                                string effectivePath,
                                                out IPackageFileTransformer transformer)
        {
            // Try to get the package file modifier for the extension
            string extension = Path.GetExtension(effectivePath);

            if (fileTransformers.TryGetValue(extension, out transformer))
            {
                // Remove the transformer extension (e.g. .pp, .transform)
                string truncatedPath = RemoveExtension(effectivePath);

                // Bug 1686: Don't allow transforming packages.config.transform,
                // but we still want to copy packages.config.transform as-is into the project.
                string fileName = Path.GetFileName(truncatedPath);
                if (Constants.PackageReferenceFile.Equals(fileName, StringComparison.OrdinalIgnoreCase))
                {
                    // setting to null means no pre-processing of this file
                    transformer = null;
                }
                else
                {
                    effectivePath = truncatedPath;
                }
            }

            return(projectSystem.ResolvePath(effectivePath));
        }
示例#2
0
        private static string ResolveTargetPath(IProjectSystem projectSystem, IDictionary <FileTransformExtensions, IPackageFileTransformer> fileTransformers, Func <FileTransformExtensions, string> extensionSelector, string effectivePath, out IPackageFileTransformer transformer)
        {
            string str;

            transformer = FindFileTransformer(fileTransformers, extensionSelector, effectivePath, out str);
            if (transformer != null)
            {
                effectivePath = str;
            }
            return(projectSystem.ResolvePath(effectivePath));
        }
        private static string ResolveTargetPath(IProjectSystem projectSystem,
                                                IDictionary <FileTransformExtensions, IPackageFileTransformer> fileTransformers,
                                                Func <FileTransformExtensions, string> extensionSelector,
                                                string effectivePath,
                                                out IPackageFileTransformer transformer)
        {
            string truncatedPath;

            // Remove the transformer extension (e.g. .pp, .transform)
            transformer = FindFileTransformer(fileTransformers, extensionSelector, effectivePath, out truncatedPath);
            if (transformer != null)
            {
                effectivePath = truncatedPath;
            }

            return(projectSystem.ResolvePath(effectivePath));
        }
 private static string ResolvePath(IProjectSystem projectSystem, string path)
 {
     return(projectSystem.ResolvePath(RemoveContentDirectory(path)));
 }