dotnet / dotnet/msbuild

Can't get WebSite Project relative path from Sln file

Open
#626 5 comments 0 reactions 0 assignees View on GitHub
Area: Solution (.sln) triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

I try to get WebSite Project Relative path from Sln file by using "Microsoft.Build.Construction.SolutionFile". But the relative path is wrong in "ProjectInSolution" type.

For example, this is Sln file, relative path is "http://localhost/WebSite" in "ProjectInSolutin" type, How Can I get "............\inetpub\wwwroot\WebSite\" from "ProjectInSolution"? Or is there any other type I can use?

```
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14

VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebSite", "http://localhost/WebSite", "{0E90CBE5-EA94-41CD-8A64-8D5418B0B5D8}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "false"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5.1"
Debug.AspNetCompiler.VirtualPath = "/WebSite"
Debug.AspNetCompiler.PhysicalPath = "............\inetpub\wwwroot\WebSite\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WebSite\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/WebSite"
Release.AspNetCompiler.PhysicalPath = "............\inetpub\wwwroot\WebSite\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WebSite\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "............\inetpub\wwwroot\WebSite\"
DefaultWebSiteLanguage = "Visual C#"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0E90CBE5-EA94-41CD-8A64-8D5418B0B5D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E90CBE5-EA94-41CD-8A64-8D5418B0B5D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.