msbuild/clickonce publish files generated during the build

后端 未结 4 688
不知归路
不知归路 2021-02-10 22:52

As a part of my build process I generate some files that should be included when creating a clickonce deployment.

Here is a blog post of someone telling you how to incl

相关标签:
4条回答
  • 2021-02-10 23:22

    So you want to include files which are generated by a build.

    I think, although you said that it's not an option, that the only solution is to perform a manual deployment via Mage or MageUI. Only that way you're in control between the build and the deployment. Can't you create a batch file to deploy your application? You can execute the batch file in the Post-Build event.

    0 讨论(0)
  • 2021-02-10 23:24

    You can do something like this:

    <ItemGroup Condition="'$(Configuration)' == 'Release'">
        <Content Include="..\bin\Release\Reports\Report.srf" Condition="Exists('..\bin\Release\Reports\Reports.srf')">
          <Link>Reports\Reports.srf</Link>
          <Visible>false</Visible>
        </Content>
    </ItemGroup>
    

    This will require that you run the build and publish in 2 steps. That is, from a clean working copy, msbuild /p:Configuration=Release /t:Publish will not include this file in the deployment, you'll have to first run msbuild /p:Configuration=Release and then msbuild /p:Configuration=Release /t:Publish , the manifest will get updated during the Publish.

    0 讨论(0)
  • 2021-02-10 23:28

    Try this: Build your project. Then go into the Application Files dialog and click "show all files". Does it show the files you want to include? If so, mark them as include(required). It should keep those, and include them in the deployment.

    RobinDotNet

    0 讨论(0)
  • 2021-02-10 23:41

    Check out this post. I'm pretty sure that's the one I used when I setup our deployment process here.

    We need to include non .net dlls in the bin directory for our app to work, they're already built so I don't have your problem of 'need to build first'. However I do the 'include' as part of the BeforePublish target:

       <Target Name="BeforePublish" DependsOnTargets="IncludeAdditionalPublishFiles; 
            ReleaseModeUpdateConfig;
            ReleaseModeInsertDatabaseRecords " />
    
      <ItemGroup>
        <AdditionalPublishFile Include="..\..\..\..\..\SharedDependencies\Leadtools\Leadtools.Codecs.J2k.dll">
          <Visible>False</Visible>
        </AdditionalPublishFile>
      </ItemGroup>
    
    
    <Target Name="IncludeAdditionalPublishFiles" Condition=" '$(Configuration)' == 'Release' And Exists('@(IntermediateAssembly)') " >
        <Touch Files="@(IntermediateAssembly)" />
        <CreateItem Include="@(AdditionalPublishFile)" AdditionalMetadata="TargetPath=%(FileName)%(Extension);IsDataFile=false">
          <Output TaskParameter="Include" ItemName="_DeploymentManifestFiles" />
        </CreateItem>
      </Target>
    

    As you can see, IncludeAdditionalPublishFiles does the 'include' work (check the blog post for a 'what the hells going on here'), I also update the config and set some values in an SQL Compact Db.

    It takes a bit of trial and error to get it right but works in the end. Note you can add as many AdditionalPublishFile as you want.

    0 讨论(0)
提交回复
热议问题