日期:2014-05-20  浏览次数:20925 次

【VS2005】+【WebDeployment】自动编译与发布网站的问题
1、怎么实现邮件的自动发送?

2、压缩后的zip文件夹是空的,请帮忙看看怎么回事儿?
C# code



<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.60403</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{575C9DE5-1C73-4C57-92E1-90B867EE607A}</ProjectGuid>
    <SourceWebPhysicalPath>..\Web</SourceWebPhysicalPath>
    <SourceWebProject>{00775177-90F2-4D8D-AA87-D264516327A5}

|D:\WorkSpace\XXXX\Web</SourceWebProject>
    <SourceWebVirtualPath>/Web</SourceWebVirtualPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <OutputPath>.\Debug</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>Web_deploy</SingleAssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <OutputPath>.\Release</OutputPath>
    <EnableUpdateable>true</EnableUpdateable>
    <UseMerge>true</UseMerge>
    <SingleAssemblyName>Web_deploy</SingleAssemblyName>
  </PropertyGroup>
  <ItemGroup>
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)

\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
  <Target Name="BuildProjectReferences">
    <MSBuild Projects="@(ProjectReference)" Targets="Build" />
  </Target>
  <Target Name="Email" >
    <Message Text = " Mail sending"></Message>
    <Mail SmtpServer="$(XXX.com.cn)"
    Subject="Test"
    Password="$(******)"
    From ="$(XXXX@XXX.com.cn)"
    To ="$(XXXX@XXX.com.cn)"
    Body="This is a test of the mail task." />
  </Target>
  <Target Name="Zip">
    <Time Format="yyyyMMddHHmmss">
      <Output TaskParameter="FormattedTime" PropertyName="buildDate"/>
    </Time>
    <Zip Files="@(ZipFiles)" ZipFileName="aspx V$(Major)-$(Minor)-$(Revision)-

$(buildDate).zip"/>
  </Target>
  <Target Name="Copy">
    <ServiceController ServiceName="w3svc" Action="Stop" />
    <Exec Command="Robocopy Debug D:\aspx /MIR /XD Fckeditor attachments .svn obj 

doc Test /XF *.zip *.wdproj *.user *.cs *.csproj" IgnoreExitCode="true" />
    <ServiceController ServiceName="w3svc" Action="Start" />
  </Target>
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v8.0

\Microsoft.WebDeployment.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and 

uncomment it. 
       Other similar extension points exist, see Microsoft.WebDeployment.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="BeforeMerge">
  </Target>
  <Target Name="AfterMerge">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="BeforeMerge">
  </Target>
  <Target Name="AfterMerge">
  </Target>
  <Target Name="AfterBuild">
    <CallTarget Targets="Zip"/>
    <CallTarget Targets="Copy"/>
    <CallTarget Targets="Email"/>
  </Target>
</Project>