2017-03-16 69 views
2

我张贴了这个问题,在GitHub上/微软/的MSBuild但我希望更广泛的社区可能有一些这方面的早期经验。错误App.Config中publish.targets的MSBuild 15

我的工作从2015年VS(.NET核心预览)转换的解决方案/项目VS 2017年最新的.NET的核心。

的解决方案现在建立完全正常在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是项目和代码是的AssemblyName(它最终会被更好的重命名为东西)。正如你可以看到它正在寻找“Sitecore.Foundation.Commerce.Engine.csproj.code.exe.config”,它不存在。但是code.exe.config确实存在。

我很乐意给GitHub上的任何人有兴趣帮助这个数字一出来跟我,因为它是从做仓库公众阻挡我们回购的访问。从MSBuild的

所以code.exe.config解析为Sitecore.Foundation.Commerce.Engine.csproj.code.exe.config

输出片段:

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 

这里是Sitecore.Foundation .Commerce.Engine.csproj内容:

<?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> 
+0

链接到GitHub问题:https://github.com/Microsoft/msbuild/issues/1873 – jflsitecore

回答

0

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

我很抱歉,如果这没有帮助别人,但是这似乎已经解决了我们的具体问题。