我正在为我们的应用程序创建一个CI服务器,并且我们的网站项目遇到了msbuild的问题。它建立了一个解决方案,但没有proj文件(因为它不是一个网站应用程序,不能)。 MSBuild不会将dll.refresh文件拉入bin文件夹。 (不是特定于CI问题,但这是目标)如果我针对devenv.com(CLI尝试)运行它来构建然后它确实拉入了dll.refresh并且似乎工作得很好。
从我在MsBuild日志中可以找到的内容,看起来复制任务(这只是msbuild本身的默认规则)在查找DLL文件时并不是目标/ bin文件夹,而是根目录解决方案(在这种情况下为/ www)。
只是寻找更多信息,因为此时所有其他研究点似乎已经枯竭。 (它是否必须是Msbuild?不,但我想让CI配置非常简单,任何人都可以重新生成和自定义构建脚本/批处理文件,并且在CI服务器上安装VS会使其更加复杂)
感谢。
答案 0 :(得分:1)
我无法重现您使用VS2013 / MSBuild 12.0.31101.0描述的行为。
摄制:
bin
*.refresh
目录
msbuild WebsiteSolution.sln
结果:重新创建*.refresh
中引用的DLL。
生成的MSBuild文件的读取显示*.refresh
文件中的路径相对于网站的基本目录已解析。我会注意到这只发生在Build
目标上,所以当你说'#34;复制任务[...]是默认规则"时,我不知道你的意思。也许您正在使用一些需要包含默认目标的自定义MSBuild目标?
生成的MSBuild的相关部分(使用MSBuildEmitSolution=1
生成):
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<!-- Edit: Snipped -->
<!-- The website location is stored relative to the .sln -->
<!-- (which is the same as the location of the temporary msbuild file) -->
<Project_[...]_AspNetPhysicalPath>..\..\WebSites\WebSite1\</Project_[...]_AspNetPhysicalPath>
<!-- Edit: Snipped -->
</PropertyGroup>
<ItemDefinitionGroup />
<!-- Edit: Snipped -->
<Target Name="Build" Condition=" ('$(CurrentSolutionConfigurationContents)' != '') and (false or ( ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') ) or ( ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') )) " DependsOnTargets="GetFrameworkPathAndRedistList">
<!-- Edit: Snipped -->
<!-- *.refresh items are discovered and saved in [...]_References_RefreshFile -->
<CreateItem Include="$(Project_[...]_AspNetPhysicalPath)\Bin\*.refresh">
<Output TaskParameter="Include" ItemName="Project_[...]_References_RefreshFile" />
</CreateItem>
<!-- The contents of the *.refresh are read to [...]_References_ReferenceRelPath -->
<ReadLinesFromFile Condition=" '%(Project_[...]_References_RefreshFile.Identity)' != '' " File="%(Project_[...]_References_RefreshFile.Identity)">
<Output TaskParameter="Lines" ItemName="Project_[...]_References_ReferenceRelPath" />
</ReadLinesFromFile>
<!-- Those contents are relative to [...]_AspNetPhysicalPath -->
<CombinePath BasePath="$(Project_[...]_AspNetPhysicalPath)" Paths="@(Project_[...]_References_ReferenceRelPath)">
<Output TaskParameter="CombinedPaths" ItemName="Project_[...]_References" />
</CombinePath>
<!-- This seems to be a no-op, since you cannot copy if it doesn't exist -->
<Copy Condition="!Exists('%(Project_[...]_References.Identity)')" ContinueOnError="true" SourceFiles="@(Project_[...]_References->'%(FullPath)')" DestinationFolder="$(Project_[...]_AspNetPhysicalPath)\Bin\" />
<!-- Edit: Snipped -->
<!-- This will copy [...]_References to [...]_References_CopyLocalFiles and add references -->
<ResolveAssemblyReference Condition="Exists('%(Project_[...]_References.Identity)')" Assemblies="@(Project_[...]_References->'%(FullPath)')" TargetFrameworkDirectories="$(Project_[...]__TargetFrameworkDirectories)" FullFrameworkFolders="$(Project_[...]__FullFrameworkReferenceAssemblyPaths)" SearchPaths="{RawFileName};{TargetFrameworkDirectory};{GAC}" FindDependencies="true" FindSatellites="true" FindSerializationAssemblies="true" FindRelatedFiles="true" TargetFrameworkMoniker=".NETFramework,Version=v4.5">
<Output TaskParameter="CopyLocalFiles" ItemName="Project_[...]_References_CopyLocalFiles" />
</ResolveAssemblyReference>
<!-- [...]_References_CopyLocalFiles is copied to the bin directory -->
<Copy Condition="(false) or ('$(AspNetConfiguration)' == 'Debug') or ('$(AspNetConfiguration)' == 'Release')" SourceFiles="@(Project_[...]_References_CopyLocalFiles)" DestinationFiles="@(Project_[...]_References_CopyLocalFiles->'$(Project_[...]_AspNetPhysicalPath)\Bin\%(DestinationSubDirectory)%(Filename)%(Extension)')" />
<!-- Edit: Snipped -->
</Target>
<!-- Edit: Snipped -->
</Project>
我没有在没有安装VS的机器上试过这个,所以它可能不会直接应用,但是你应该能够使用生成的metaproj
文件进行构建,即使没有安装Visual Studio也是如此。
答案 1 :(得分:0)
我也有这个问题;问题实际上我们的构建配置既不是Debug也不是Release,所以msbuild实际上是在跳过编译(因此使用* .refresh进行恢复):
跳过因为&#34; Dev&#34;此Web不支持配置 项目。您可以使用AspNetConfiguration属性覆盖 用于构建Web项目的配置,通过添加 / p:AspNetConfiguration =到命令行。目前网络 项目仅支持调试和发布配置。