简体   繁体   中英

Building ASP.net Web Application without Web Development Project Targets

is there a way in a web development project to copy only the changed files in your ASP.net Web Application project without Web Development Project targets?

So, my flow will go like this: 1.) Compile only the application that has changed/updated files in the right order (ie compile the Library project before the Web Application since the Web Application depends on the Library), 2.) Copy only the changed files to the Release folder. 3.) I would like to do this without having to use Web Development Project targets. My Web Development Project configuration file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{399DEB82-5D44-466C-ADD5-D76F85A519D8}</ProjectGuid>
    <SourceWebPhysicalPath>..\Tracker_Web</SourceWebPhysicalPath>
    <SourceWebProject>{A2536EFD-8583-4C35-8F18-21F61DA861C3}|Tracker_Web\Tracker_Web.csproj</SourceWebProject>
    <SourceWebVirtualPath>/Tracker_Web.csproj</SourceWebVirtualPath>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>.\Debug</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>Tracker_Web_Deploy</SingleAssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <OutputPath>.\Release</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>Tracker_Web_Deploy</SingleAssemblyName>
    <DeleteAppDataFolder>true</DeleteAppDataFolder>
</PropertyGroup>
<ItemGroup>
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\obj\**\*.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\Properties\**\*.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.csproj*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.resx" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.sln" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\_svn\**\*.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\.svn\**\*.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\App_Data\**\*.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\bin\**\*.pdb" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\bin\**\*.xml" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\bin\Tracker_Web_Deploy.*" />
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\Exception*.aspx*" />
    <ProjectReference Include="..\Tracker_Web\Tracker_Web.csproj">
        <Project>{A2536EFD-8583-4C35-8F18-21F61DA861C3}</Project>
        <Name>Tracker_Web</Name>
    </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v10.0\Microsoft.WebDeployment.targets" />
<Target Name="BeforeBuild">
</Target>
<Target Name="BeforeMerge">
</Target>
<Target Name="AfterMerge">
</Target>
<Target Name="AfterBuild">
    <MakeDir Directories="$(OutputPath)\App_Data" />
    <RemoveDir Directories=".\Source" />
    <Message Text="Delete File: $(SourceWebPhysicalPath)\bin\Tracker_Web_Deploy.dll" Importance="high" />
    <Exec Command="del /F /Q $(SourceWebPhysicalPath)\bin\Tracker_Web_Deploy.dll" />
</Target>

I saw how to do this using MSBuild, but not with a Web Development Project. Any help would be greatly appreciated.

If you're using VS2010, there's a better publish wizard included with the latest Azure SDK releases. See here for details. It brings most of the functionality of Web Deployment Projects into the Web Application Project itself. By default, the publish experience is incremental - you'll only publish files which have changed since the last publish.

Web Deployment Projects are deprecated as of VS2012, so you'll end up using the new wizard whenever you update your version of VS anyways.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM