简体   繁体   中英

How to overwrite checked in files under TFS from a post-build script in VS2010?

I have a VS2010 solution with a WebForms project that is setup to publish using Web Deploy. There is another WinForms project and a WinForms Setup, whose output I need publishedas well.

Now these setup files are added to the Web project and normally remain checked in. We used to manually replace them before.

I tried writing a post-build script on the WebClient to copy from the Setup project and replace older versions but ran in to the 'Access Denied' issue since the old setup files were checked in.

Question:

  • Is there a better way to include files in Web Deploy publish that are not part of the project?
  • If not, is there a way to auto-check-out these files so they can be overwritten using a batch script?

Is there a better way to include files in Web Deploy publish that are not part of the project?

Yes. Web Deploy copies your web application's files to a temporary folder before it deploys (or packages) them. Your best bet would be to hook into that event and copy your setup files into the temporary directory structure.

<!-- This goes in your publish profile (or ProjectName.wpp.targets if you don't 
     have the Azure SDK or VS 2012 installed) -->
<PropertyGroup>
  <PipelineCollectFilesPhaseDependsOn>
    CollectWindowsFormsApp;
    $(PipelineCollectFilesPhaseDependsOn);
  </PipelineCollectFilesPhaseDependsOn>
</PropertyGroup>

<Target Name="CollectWindowsFormsApp">
  <ItemGroup>
    <FilesForPackagingFromProject  Include="$(SolutionDir)YourWindowsFormsApp\bin\debug\YourWindowsFormsApp.msi">
      <DestinationRelativePath>App_Data\YourWindowsFormsApp.msi</DestinationRelativePath>
    </FilesForPackagingFromProject>
  </ItemGroup>
</Target>

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