【问题标题】:Why does msbuild try to copy from wrong path?为什么 msbuild 会尝试从错误的路径复制?
【发布时间】:2015-04-04 10:24:17
【问题描述】:

我尝试使用 MSBuild 构建 Windows 应用商店应用程序。

C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild.exe /t:build /p:Configurat
ion=Release;Platform=x86 E:\MyApp.W8.csproj /logger:FileLogger,Microsoft.Build.Engine;logfile=E:/log/test.txt /p:OutputPath=E:/result

我得到了这个错误:

"E:\MyApp.W8.csproj " (构建目标) (1) -> (CopyGeneratedXaml 目标)-> C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0\8.1\Microsoft.Wind ows.UI.Xaml.Common.targets(476,9):错误 MSB3021:无法复制文件“obj\x86\ Release\E:\MyApp.Shared\App.xbf" 到 "E:\result\E:\MyApp.Shared\App.xbf"。给定路径的格式不是 支持的。 [E:\MyApp.W8.csproj]

我不知道为什么 MSBuild 会尝试使用

obj\x86\Release\E:\MyApp.Shared\App.xbf
instead obj\x86\Release\App.xbf

或 App.xbf 的绝对路径。

【问题讨论】:

  • 那个 OutputPath 属性被严重破坏了。很难看出这是怎么发生的,您必须发布详细的构建跟踪才能猜测。路径名中的正斜杠是红旗,在 Windows 上正确的是反斜杠。但是当我尝试时不会出错。
  • 感谢您的回答。我找到了一个决定。我尝试从另一个位置使用 MSBuild。 MSBuild 来自 VS,它编译一切正确。

标签: msbuild windows-store-apps


【解决方案1】:

根据this post,在您的 .projiitems 文件中,您将找到以下代码:

<ApplicationDefinition Include="$(MSBuildThisFileDirectory)App.xaml">
<SubType>Designer</SubType>
</ApplicationDefinition>

将其替换为:

<ApplicationDefinition Include="$(MSBuildThisFileDirectory)App.xaml">
<SubType>Designer</SubType>
<Link>App.xaml</Link>
</ApplicationDefinition>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-08
    • 2019-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-02
    • 1970-01-01
    相关资源
    最近更新 更多