在目标外部访问PropertyGroup

时间:2018-07-04 10:17:09

标签: c# visual-studio msbuild target

问题

我在顶级instanceOfWinRTObject.OnSuspendingEvent += async (sender, args) => { var deferral = args.Deferral; try { // Client does some async work with a result args.Result = await GetSomeStringAsync(args); } finally { deferral.Complete(); } } 上定义了4个自定义Property

  • PropertyGroup
  • AndroidResourcesFolder
  • NugetFolder(使用BrandingFiles
  • NugetFolder(使用AssemblyFile

...,我想从BrandingFiles访问AndroidResourcesFolder

Target访问AssemblyFile时,UsingTask已正确解析 ,但是当我从{{1}访问Property时},Visual Studio报告AndroidResourcesFolder没有值:

  

错误MSB4044:未为“ Mobile.Branding.Build.Task.CleanResources”任务提供必需参数“ AndroidResourcesFolder”的值。

代码

这是我的Target文件:

Property

问题

为什么只有3个.targets 得到解决,而其余(<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <AndroidResourcesFolder>$(MSBuildProjectDirectory)\Resources\</AndroidResourcesFolder> <NugetFolder>$(MSBuildThisFileDirectory)..\..\</NugetFolder> <BrandingFiles>$(NugetFolder)MonoAndroid81\</BrandingFiles> <AssemblyFile>$(BrandingFiles)\Amaris.Mobile.Branding.Build.dll</AssemblyFile> </PropertyGroup> <UsingTask TaskName="Mobile.Branding.Build.Task.CleanResources" AssemblyFile="$(AssemblyFile)" /> <UsingTask TaskName="Mobile.Branding.Build.Task.ReadConfig" AssemblyFile="$(AssemblyFile)" /> <Target Name="ReadConfig" > <PropertyGroup> <ConfigFile>$(MSBuildProjectDirectory)\branding.xml</ConfigFile> </PropertyGroup> <Mobile.Branding.Build.Task.ReadConfig ConfigFile="$(ConfigFile)" /> </Target> <Target Name="BeforeClean" DependsOnTargets="ReadConfig" > <Mobile.Branding.Build.Task.CleanResources AndroidResourcesFolder="$(AndroidResourcesFolder)" /> </Target> </Project> )却被排除在外?

谢谢!

0 个答案:

没有答案