microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.03k stars 401 forks source link

Service Fabric project not packaging the referenced project correctly #1100

Open anubhms opened 4 years ago

anubhms commented 4 years ago

My Service Fabric project has this project reference to the web role project.

  <ItemGroup>
    <ProjectReference Include="..\WebRole\WebRole.csproj">
      <ServiceLaunchUrl>http://{MachineName}:{ServicePort}/</ServiceLaunchUrl>
    </ProjectReference>
  </ItemGroup>

The WebRole.csproj looks like this -

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <IsServiceFabricServiceProject>True</IsServiceFabricServiceProject>
    <ServerGarbageCollection>True</ServerGarbageCollection>
    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
    <Platforms>x64</Platforms>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\ProjectA.csproj" />
    <ProjectReference Include="..\..\ProjectB.csproj" />
    <ProjectReference Include="..\..\ProjectC.csproj" />
  </ItemGroup>

  <Target Name="TestTarget" AfterTargets="Build">
    <ItemGroup>
      <Plugin Include="$(BaseDir)\out\Plugins\**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(Plugin)" DestinationFolder="$(TargetDir)\Plugins\%(RecursiveDir)" SkipUnchangedFiles="false" />
  </Target>

</Project>

When I build the webRole.csproj, the out directory looks something like this, the TestTarget copies all the files correctly to the Plugins directory-

WebRole
+--Plugins
|  +--Test
|  |  +--A.dll
|  |  +--B.json
+--C.dll
+--D.dll
+--WebRole.exe

But when I package the sfproj, the output looks like this, the Plugins folders is not present in the output - (to keep the diagram simple, have not included the config folder and manifest files)

TestApplication
+--WebRolePkg
|  +--Code
|  |  +--C.dll
|  |  +--D.dll
|  |  +--WebRole.exe

What needs to be done so that sfproj packages the Plugins folder?

Plz let me know if more details like, sfproj file content, etc is needed.

sukanyamsft commented 3 years ago

Hi anubhms, Just following up to check if you still have this issue. Visual studio projects allows the ability to add non-project files/assets with the use of 'PackageReference' tags. Did you give that a try as well? Thanks