【发布时间】:2018-07-15 05:45:35
【问题描述】:
msbuild.proj 文件中的相关内容:
<Message Text="*****check the site exists*****" Importance="high"/>
<Exec Command="C:\WINDOWS\System32\inetsrv\appcmd.exe list site /name:$(WebAppSiteName) " ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode2" />
</Exec>
<Message Text="*****if not exists create site*****" Importance="high" Condition="'$(ErrorCode2)' > '0'" />
<Exec Command="C:\WINDOWS\System32\inetsrv\appcmd.exe add site /name:$(WebAppSiteName) /bindings:http/*:80:$(SiteDomain) /applicationDefaults.applicationPool:$(WebAppSiteName) /physicalPath:$(BuildSolutionDir)$(DeployDir)Website" Condition="$(WebAppSiteName)!='' and '$(ErrorCode2)' > '0'"></Exec>
上图:runtime的实际参数(/physicalPath)值为: D:\YDJWebsite.Dev\deply\fw\..\..\mkltest2Website
其实上面的路径等价于D:\YDJWebsite.Dev\mkltest2Website
访问该站点时,错误显示: 500内部服务器错误, 找不到资源
如果我将路径更改为正确的格式“D:\YDJWebsite.Dev\mkltest2Website”,错误就消失了
the physical path of website in iis shows here.
现在,我知道唯一的解决方案是将参数值(/physicalPath)转换为正确的格式?
但是如何在 proj 文件中做到这一点?有什么建议吗?谢谢。
【问题讨论】: