我目前有一个与web.api项目相关的解决方案,我想将其部署到本地IIS中的不同虚拟目录中。目前,在api的.csproj文件中我正在执行以下操作:
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)' == 'CustomerOne.Debug'">
<CustomerName>CustomerOne</CustomerName>
....
</PropertyGroup>
...
这些变量被广泛地用于web.config转换、复制到不同位置等操作中,通过像
$(CustomerName)
这样的引用来调用它们。唯一不起作用的地方是虚拟目录的定义,即我想将构建配置连接到下面的
IISUrl
,你可以硬编码它:<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
...
<IISUrl>http://localhost/api/something</IISUrl>
...
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
用
<IISUrl>http://localhost/api/$(CustomerName)</IISUrl>
替换这个并不起作用。有什么想法吗?
DefineConstants
。 - l33t