- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近将一个解决方案从使用旧的 xml 格式的 csproj 文件升级为 xproj 被弃用后的新格式。即格式看起来像这样:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<AssemblyName>MyProject</AssemblyName>
<PackageId>MyProject</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
</Project>
问题是该解决方案包含大量已停止工作的 xml 转换。据我了解,这些转换是由 MyProject.wpp.targets 文件启动的。我自己还没有设置过这个,我对此也没有太多了解,但由于这个文件与旧的 csproj 文件格式相同,我猜这可能是它不起作用的原因,但我不这样做我不知道。非常感谢有关如何使其再次正常工作的任何帮助。
这就是 wpp.target 文件现在的样子
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="[MSBuild]\CommonConfigTransforms.xml"/>
<Import Project="[MSBuild]\BuildSpecificConfigTransforms.xml"/>
<Import Project="[MSBuild]\DeleteTempConfigFiles.xml"/>
<PropertyGroup>
<PrepareForBuildDependsOn>
$(PrepareForBuildDependsOn);
CommonConfigTransforms;
BuildSpecificConfigTransforms;
</PrepareForBuildDependsOn>
<BuildDependsOn>
$(BuildDependsOn);
DeleteTempConfigFiles
</BuildDependsOn>
</PropertyGroup>
</Project>
最佳答案
来自Migrating tasks from old csproj to new csproj format #2746 MSBuild 存储库的 GitHub 问题:
You have to change Target to be suitable with new approach (in this situation AfterTargets="PrepareForBuild") so the new part of csproj should looks like this:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="ApplyConfigurationConfigFile" AfterTargets="PrepareForBuild" Condition="Exists('App.$(Configuration).config')">
<ItemGroup>
<AppConfigWithTargetPath Remove="App.config" />
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
<TransformXml Source="App.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="App.$(Configuration).config" />
</Target>
关于.net - 使用新的 csproj 格式 TransformXml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47312487/
这个问题在这里已经有了答案: Publish error: Could not load file or assembly 'Microsoft.Web.XmlTransform', Version
我最近将一个解决方案从使用旧的 xml 格式的 csproj 文件升级为 xproj 被弃用后的新格式。即格式看起来像这样: net461 MyProject MyPr
我正在尝试使用 TransformXml 任务一次性转换所有配置,而不管在 visual studio 中选择的构建配置如何。我可以通过编辑 .csproj 文件来完成它,就在这里。
我正在使用 MsBuild 和 TransformXml 任务来设置一些 web.config 文件。这一切都工作得很好,但现在我想在 xml 转换中扩展 MSBuild 属性。 更清楚地说,我使用项
我正在使用以下(高度简化的)MSBuild 脚本: 这对于转换单个配置文件非常有效,而无需通过 MSDeploy。 但是,假设在我的
将 Slow Cheeath(v. 2.5.10.3)安装到我的解决方案中的两个项目后,我收到以下错误: "The "SlowCheetah.Xdt.TransformXml" task could
在观看 Scott Hanselman 的 video on web deployment 后,我刚刚在 VS2010 RC 中的 .NET 3.5 项目上启用了配置转换。 。不幸的是,每次我去发布时
您好,我已经使用 TeamCity 构建了服务器。我的项目是 Sitecore Web 应用程序。我正在使用 TDS(HedgehogDevelopment)。我在 TeamCity 中使用 MS b
按照 this answer 中的步骤操作后,当尝试通过单声道构建项目时(使用 msbuild),出现以下错误: (AfterCompile target) -> project.csproj(469
有人见过这个错误并知道如何修复它吗? The "TransformXml" task could not be loaded from the assembly C:\Program Files (x
不能发布网站。当我尝试将其发布到有效的 FTP 或本地文件夹时,出现以下错误: Error 1 The "TransformXml" task failed unexpectedly. System.
我是一名优秀的程序员,十分优秀!