当前的客户端,我们正在使用VSO、=>、Azure、devops来设置CI/CD,我需要一些在环境中配置版本的帮助。这是形势和问题。
我已经把所有的构建都设置好并正常工作了。
我已经在发布配置中设置了两个环境。神器是为水滴而设的。开发环境的设置以及质量保证。
在VS2015中,我已经为Debug、Dev、QA和Release设置了web.config转换和配置。每个开发/质量保证/发布都有一个转换,将适用于各自的环境。
在签入时生成触发器,在成功构建时正确地触发发布部署。
Dev环境和QA环境都在版本中正确触发并相应地发布。
在每个任务配置中,我都选择了XML转换以及正确的部署槽。问题是,正在应用的唯一web.config转换是发布转换,而不是相应环境的正确转换。
我在环境中设置了4种转换信任。
web.config
web.Debug.config web.Dev.config web.QA.config web.Release.config
在VSO中,我在发布包中设置了两个环境
发展与质量保证
在每个环境中,我都有,工具提示声明它将应用web.Release.config和每个相应的环境配置。
后一种情况不会发生。
日志:
日志声明:
无法为给定包应用转换。验证以下内容。
在构建过程中,是否已经为MSBuild生成的包应用了转换。如果是,请删除csproj文件中每个配置的标记并重新构建。
2.确保配置文件和转换文件存在于包内的同一个文件夹中。
这两个州都得到了确认。我已经把变换设置为复制如果更新。


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.8\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.2.4.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.4.0\build\Microsoft.Net.Compilers.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{88941EE6-99FC-4DE5-8FE3-9F532FD855F2}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TripManager</RootNamespace>
<AssemblyName>TripManager</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort>44385</IISExpressSSLPort>
<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkProfile />
<Use64BitIISExpress />
<TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>
<ApplicationInsightsResourceId>/subscriptions/ee4492d7-5913-4e7b-85c0-3915e8c6c5c2/resourcegroups/rg-TripTracker-dev-SC/providers/microsoft.insights/components/TripManager</ApplicationInsightsResourceId>
<WebProject_DirectoryAccessLevelKey>1</WebProject_DirectoryAccessLevelKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'QA|AnyCPU'">
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
</Project>发布于 2017-12-12 07:22:06
无论转换是否应用于MSBuild生成的包,都会将配置文件添加到压缩包(正如发布日志中的选项2所建议的那样:确保配置文件和转换文件存在于包中的同一个文件夹中)。
因此,您可以在发布工件之前在构建定义中添加配置文件。具体步骤如下:
在Visual构建任务(以及在发布构建工件之前)和下面的任务来提取zip文件并在提取文件夹中添加配置文件,然后再次压缩文件:
1.解压缩文件任务
归档文件模式:$(Build.ArtifactStagingDirectory)\*.zip
目标文件夹:指定提取文件的文件夹,如$(Build.ArtifactStagingDirectory)\test

2.复制文件任务
来源文件夹:$(Build.SourcesDirectory)
内容:**\*.config
目标文件夹:提取文件的文件夹,如$(Build.ArtifactStagingDirectory)\test

3.删除文件任务
来源文件夹:$(Build.ArtifactStagingDirectory)
内容:*.zip (删除由Visual任务生成的压缩文件)

4.归档文件任务
用于存档的根文件夹(或文件):提取文件的文件夹,如$(Build.ArtifactStagingDirectory)\test
存档类型:zip
要创建的归档文件:如$(Build.ArtifactStagingDirectory)\package.zip

5.删除文件任务
来源文件夹:$(Build.ArtifactStagingDirectory)
内容:删除提取文件夹,如test

然后,包将部署到Azure Azure成功发布。
发布于 2019-07-10 08:33:34
问题是构建结果中不包含配置转换文件。
确保配置文件和转换文件存在于包内的同一个文件夹中。
Marina Liu's answer可以工作,但是有一种更简单的方法可以实现这一点:
Build Action设置为Content。或只需从以下内容更改.csproj文件中的条目:
<None Include="Web.QA.config">
<DependentUpon>Web.config</DependentUpon>
</None>对此:
<Content Include="Web.QA.config" />这确保生成后的包中包含了这些文件。
https://stackoverflow.com/questions/47720687
复制相似问题