错误的App.Config publish.targets MSBuild 15

错误的App.Config publish.targets MSBuild 15,msbuild,visual-studio-2017,msbuild-15,Msbuild,Visual Studio 2017,Msbuild 15,我在GitHub/Microsoft/MSBuild上发布了这个问题,但我希望更广泛的社区可能对此有一些早期经验 我正在将解决方案/项目从VS 2015(.NET core预览版)转换为VS 2017和最新的.NET core 该解决方案现在在Visual Studio 2017中构建得非常好,但我遇到的问题是在尝试使用MSBuild 15运行构建时(由于.NET核心项目,我无法使用v14)。尝试从obj\debug\net452文件夹复制.config文件失败,但由于某些原因,它正在添加完整的

我在GitHub/Microsoft/MSBuild上发布了这个问题,但我希望更广泛的社区可能对此有一些早期经验

我正在将解决方案/项目从VS 2015(.NET core预览版)转换为VS 2017和最新的.NET core

该解决方案现在在Visual Studio 2017中构建得非常好,但我遇到的问题是在尝试使用MSBuild 15运行构建时(由于.NET核心项目,我无法使用v14)。尝试从obj\debug\net452文件夹复制.config文件失败,但由于某些原因,它正在添加完整的.csproj名称

问题是Publish.Targets对.config文件执行了一些奇怪的操作

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Publish.targets(128,5):
error MSB3030: Could not copy the file "obj\Debug\net452\Sitecore.Foundation.Commerce.Engine.csproj.code.exe.config" because it was not found. 

[C:\Projects\Sitecore.Demo.Retail\src\Foundation\Commerce\Engine\code\Sitecore.Foundation.Commerce.Engine.csproj]
它将完整的项目名称(包括.csproj)预先添加到配置文件的名称中,而不仅仅是使用AssemblyName

在这种情况下,Sitecore.Foundation.Commerce.Engine.csproj是项目,代码是组件名(它最终将被更名为更好的东西)。正如您所看到的,它正在寻找“不存在的SITECOR.NET.Cudio.Cyp.jPROj.Code .exe.CONFIG”。但code.exe.config确实存在

我很高兴让任何有兴趣帮助我解决这个问题的人都可以访问GitHub repo,因为它阻止了我们公开存储库

<> >将.CODE.ex.CONFIG分解为SITECOR.NET.Cudio.Engul.CSPROJ.Code .ex.CONFIG/< MSBuild的输出代码段:

08:13:09.957     1>Target "GenerateBindingRedirectsUpdateAppConfig: (TargetId:127)" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\Projects\Sitecore.Demo.Retail\src\Foundation\Commerce\Engine\code\Sitecore.Foundation.Commerce.Engine.csproj" (target "ResolveReferences" depends on it):
                   Set Property: AppConfig=obj\Debug\net452\Sitecore.Foundation.Commerce.Engine.csproj.code.exe.config
                   Added Item(s): 
                       AppConfigWithTargetPath=
                           obj\Debug\net452\Sitecore.Foundation.Commerce.Engine.csproj.code.exe.config
                                   TargetPath=code.exe.config

这是SITECOR.Buff.Cuff.C.C.PROJJ内容:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <TargetFramework>net452</TargetFramework>
    <PreserveCompilationContext>false</PreserveCompilationContext>
    <AssemblyName>code</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>code</PackageId>
  </PropertyGroup>

  <!--<ItemGroup>
    <None Update="wwwroot\**\*">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  </ItemGroup>-->

  <ItemGroup>
    <ProjectReference Include="..\..\legacyCommerce\Plugin.Sample.Habitat\Plugin.Sample.Habitat.csproj" />
    <ProjectReference Include="..\..\legacyCommerce\Plugin.Sample.Payments.Braintree\Plugin.Sample.Payments.Braintree.csproj" />
    <ProjectReference Include="..\..\legacyCommerce\Sitecore.Commerce.Plugin.AdventureWorks\Sitecore.Commerce.Plugin.AdventureWorks.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.3" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.2" />
    <PackageReference Include="Microsoft.AspNetCore.OData" Version="6.0.0-alpha1-rtm-121216" />
    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.1.0" />
    <PackageReference Include="Serilog" Version="2.4.0" />
    <PackageReference Include="Sitecore.Commerce.Core" Version="1.0.2301" />
    <PackageReference Include="Serilog.Sinks.Literate" Version="2.1.0" />
    <PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.1" />
    <PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="1.0.2" />
    <PackageReference Include="Sitecore.Commerce.Provider.FileSystem" Version="1.0.2301" />
    <PackageReference Include="Sitecore.Framework.Rules" Version="1.1.12" />
    <PackageReference Include="Sitecore.Framework.Rules.Serialization" Version="1.1.12" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
    <PackageReference Include="Sitecore.Framework.Diagnostics" Version="1.1.4" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
    <Reference Include="System" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>

</Project>

net452
假的
代码
Exe
代码

事实证明,我们的一个NuGet引用依赖于一个不兼容的包。这反过来又以一种非常奇怪的方式表现出来

如果这对其他人没有帮助,我很抱歉,但这似乎解决了我们的具体问题。

链接到GitHub问题: