为了编译.net 4.7.1 ASP.NET MVC5,msbuild脚本确保像这样设置AspnetMergePath:
<AspnetMergePath>C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools</AspnetMergePath>
如您所见,它将AspnetMergePath设置为4.7.1 tools-dir。但是在某些机器上,当运行构建脚本时:
<ItemGroup>
<SolutionToBuild Include="$(_solutionFile)">
<Properties>
WebPublishMethod=$(WebPublishMethod);
FilesToIncludeForPublish=OnlyFilesToRunTheApp;
SkipRestoringNugetPackages=true;
LastUsedPlatform=$(Platform);
LastUsedBuildConfiguration=$(Configuration);
UseMerge=True;
DebugSymbols=False;
WDPMergeOption=MergeAllOutputsToASingleAssembly;
ExcludeApp_Data=True;
EnableUpdateable=False;
SingleAssemblyName=AppViews;
DeleteExistingFiles=True;
LaunchSiteAfterPublish=False;
PrecompileBeforePublish=True;
DeleteAppCodeCompiledFiles=True;
SiteUrlToLaunchAfterPublish=;
Platform=$(Platform);
PublishUrl=$(_tempPublishUrl);
Configuration=$(Configuration);
DeployOnBuild=$(DeployOnBuild);
AspnetMergePath=$(AspnetMergePath);
NugetServerKind=$(NugetServerKind);
DeployDefaultTarget=$(DeployDefaultTarget);
DeleteExistingFiles=$(DeleteExistingFiles);
NugetServerAccessMethod=$(NugetServerAccessMethod);
LastUsedBuildConfiguration=$(Configuration);
ExcludeGeneratedDebugSymbol=$(_excludeGeneratedDebugSymbol);
CodeAnalysisRuleSetDirectories=$(CodeAnalysisRuleSetDirectories);
$(ExtraProperties)
</Properties>
</SolutionToBuild>
</ItemGroup>
<MSBuild
Projects="@(SolutionToBuild)"
Targets="Clean;$(_targetRootProjectsInSolution)"
BuildInParallel="$(BuildInParallel)"
/>
该构建工作正常,但在msbuild-log中,我们注意到以下命令在某些计算机中发生:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\aspnet_merge.exe "C:\VS\..." -o AppViews -copyattrs "obj\rls@oracle\AssemblyInfo\AssemblyInfo.dll" -a -r
Successfully merged 'C:\VS\...'
您可以看到'aspnet_merge.exe'是从错误的目录(4.6.1而不是4.7.1)中获取的。该命令有效,但是,为什么在安装了相同类型工具的情况下,不同的计算机为何会有不同的行为?