Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Can't preview with path containing dot #5

Closed
jerone opened this issue Mar 25, 2018 · 4 comments
Closed

Can't preview with path containing dot #5

jerone opened this issue Mar 25, 2018 · 4 comments

Comments

@jerone
Copy link

jerone commented Mar 25, 2018

I'm getting the following error in the output console when I try to preview a transformation in our project:

Failed to open C:\Projects\Projects.Web\
Could not find a part of the path 'C:\Projects\Projects.Web\'.

The issue happens when there is a dot in the path. Without the dot in the path, it works again.

@enkelmedia
Copy link

Hi! I'm having a simular issue, but my root web.config file work and that files is in a folder with a ".", might it be that you have your configuration file in a subfolder? That's where I'm getting this error.

@enkelmedia
Copy link

enkelmedia commented Apr 4, 2018

After looking in the source and doing some debugging it seems like there is an interesting issue.

In ConfigTransformationManager.cs, this part is used to figure out the "parent" for the configuration transform to be tested:

var targetFileName = projectItem.Name;
var sourceLabel = parent.Name;
var sourcePath = parent.GetFullPath();
var targetLabel = targetFileName;

When I right click one of the configuration transforms in the root of the project (ie. web.Stage.config) the parent objects Name-property contains "Web.Config".

But when I right click my other settings file in a subfolder (ie /config/network.Stage.config) the parent.Name property contains "Config", which indicates that in a subfolder the parent would be the parent folder and not the parent configuration file. I've made sure that "network.Stage.config" is dependedupon the network.config-file and they are nested in the IDE.

@enkelmedia
Copy link

Some more insights, it seems that the "ParentProjectItemOrDefault()"-method in ProjectItemExtentions always start from the project root, that meens that it will return the containing folder of the file not the parent file i guess.

Might be an ide to loop over all files in the folder where the configuration transform is located and from there see if it is a child of the parent configuration file.

enkelmedia pushed a commit to enkelmedia/ConfigurationTransform that referenced this issue Apr 4, 2018
golavr added a commit that referenced this issue Jan 19, 2019
Solves issue #5 by looking at parent ProjectItem insteed of proj root
@golavr
Copy link
Owner

golavr commented Jan 19, 2019

solved with PR #6

@golavr golavr closed this as completed Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants