Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click-once publish addtional files stopped with VS 2012

I customized my project using a solution I found in this question:

Why doesn't ClickOnce in Visual Studio deploy content files from dependent assemblies?

<ItemGroup>
<AdditionalPublishFile Include="$(OutputPath)\**\*.rpt">
  <Visible>False</Visible>
</AdditionalPublishFile>
</ItemGroup>
<Target Name="BeforePublish">
  <Touch Files="@(IntermediateAssembly)" />
  <CreateItem Include="@(AdditionalPublishFile)" AdditionalMetadata="TargetPath=%(RecursiveDir)%(Filename)%(extension);IsDataFile=false">
    <Output TaskParameter="Include" ItemName="_DeploymentManifestFiles" />
  </CreateItem>
</Target>

it was working fine with VS 2010, until I upgraded to VS 2012,the additional files were not included in the application manifest !! so when the user install the application, the files mentioned were missing from the application main folder.

what has changed in VS 2012? or maybe the changes are in MSBuild?

EDIT:

I mentioned the original question where from I got the idea, basically I'm using Dependency Injection to load some assemblies, which means there is no hard reference between my project and the assemblies, so the click-once deploy will not take into consideration those assemblies, which force me either to add them to the project, or to use the mentioned solution, I chose the mentioned solution as it is invisible and easy.

but it was broken after migrating to VS 2012.

like image 750
Nour Avatar asked Feb 13 '13 06:02

Nour


2 Answers

I found your question baffling because I've never seen anybody do this with ClickOnce before, so I talked to the ClickOnce guy at Microsoft about it. He said that what you are doing it not supported, so it's not something they would have tested for. There are multiple changes to msbuild that could have broken what you are doing.

Is what you are trying to do is get files associated with a secondary reference included in the deployment? In other words, you have a main project that references another assembly that is created by building a second project, and the second assembly has content files, and you want them included in your project?

If that's what you are trying to do, you should consider linking those files to the main project instead. To do that, you can add an existing item as a link, and point it to the content in the second project. Then the content will be included when you build the first project.

like image 74
RobinDotNet Avatar answered Oct 11 '22 14:10

RobinDotNet


Move the CreateItem task to the BeforeBuild step and remove the Touch task:

<ItemGroup>
  <AdditionalPublishFile Include="$(OutputPath)\**\*.rpt">
    <Visible>False</Visible>
  </AdditionalPublishFile>
</ItemGroup>
<Target Name="BeforeBuild">
  <CreateItem Include="@(AdditionalPublishFile)" AdditionalMetadata="TargetPath=%(RecursiveDir)%(Filename)%(extension);IsDataFile=false">
    <Output TaskParameter="Include" ItemName="_DeploymentManifestFiles" />
  </CreateItem>
</Target>
like image 22
Ben Arroyo Avatar answered Oct 11 '22 14:10

Ben Arroyo