在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
最近重构一个内部的平台系统,作为一个平台,其下有几个子系统,每个子系统有自己的网站系统。而每个网站使用的是统一的风格,统一的验证机制,反馈系统,等等。所以,为了避免几个子系统中重复出现相同的资源或文件,我打算将以前的ASP.NET Web Site全部转换为ASP.NET Web Application,然后通过链接外部公共文件的方式解决这个问题。同时: <MSBuild Projects="d:\Demo\Web.csproj" Targets="ResolveReferences;_CopyWebApplication;" Properties="WebProjectOutputDir=d:\Publish\;OutDir=d:\Publish\Bin\;Configuration=Release"></MSBuild>
<!--
============================================================ _CopyWebApplication MODIFIED: Ignores linked files as part of normal deployment logic. This target will copy the build outputs along with the content files into a _PublishedWebsites folder. This Task is only necessary when $(OutDir) has been redirected to a folder other than ~\bin such as is the case with Team Build. ============================================================ --> <Target Name="_CopyWebApplication" Condition="'$(OutDir)' != '$(OutputPath)'"> <!-- Log tasks --> <Message Text="Copying Web Application Project Files for $(MSBuildProjectName)" /> <!-- Create the _PublishedWebsites\app\bin folder --> <MakeDir Directories="$(WebProjectOutputDir)\bin" /> <!-- Copy build outputs to _PublishedWebsites\app\bin folder --> <Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(AddModules)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" /> <Copy SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)" DestinationFolder="$(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)" SkipUnchangedFiles="true" Condition="'$(_SGenDllCreated)'=='true'" /> <Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).pdb" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" Condition="'$(_DebugSymbolsProduced)'=='true'" /> <Copy SourceFiles="@(DocFileItem)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" Condition="'$(_DocumentationFileProduced)'=='true'" /> <Copy SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)" DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" /> <!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder --> <Copy SourceFiles="@(ReferenceCopyLocalPaths)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" /> <!-- MODIFICATION HERE: Copy local content files (i.e. non-linked files) recursively to _PublishedWebsites\app\ folder --> <Copy Condition=" '%(Content.Link)' == '' " SourceFiles="%(Content.Identity)" DestinationFolder="$(WebProjectOutputDir)\%(Content.RelativeDir)" /> </Target> <!-- ============================================================ CopyLinkedContentFiles A new target to copy any linked content files into the web application output folder. NOTE: This is necessary even when '$(OutDir)' has not been redirected. ============================================================ --> <Target Name="CopyLinkedContentFiles"> <!-- Remove any old copies of the files --> <Delete Condition=" '%(Content.Link)' != '' AND Exists('$(WebProjectOutputDir)\%(Content.Link)') " Files="$(WebProjectOutputDir)\%(Content.Link)" /> <!-- Copy linked content files recursively to the project folder --> <Copy Condition=" '%(Content.Link)' != '' " SourceFiles="%(Content.Identity)" DestinationFiles="$(WebProjectOutputDir)\%(Content.Link)" /> </Target> <!-- Override the default target dependencies to --> <!-- include the new _CopyLinkedContentFiles target. --> <PropertyGroup> <PrepareForRunDependsOn> $(PrepareForRunDependsOn); _CopyWebApplication; CopyLinkedContentFiles; _BuiltWebOutputGroupOutput </PrepareForRunDependsOn> </PropertyGroup> </Project>
<MSBuild Projects="D:\Demo\Web.csproj" Targets="ResolveReferences;_CopyWebApplication;CopyLinkedContentFiles" Properties="WebProjectOutputDir=D:\Publish\;OutDir=D:\Publish\Bin\;Configuration=Release"></MSBuild>
|
请发表评论