Similar questions here and here didn't work in my case. The xcopy commands I use in Post Build per project won't work in Azure pipelines and build fails. Without getting this done, i can't publish to staging. So basically I am stuck.
My source structure is shown in below screen shot;
As you see the plugin projects are inside /Modules folder. In VS I have post build xcopy commands in every plugin project inside /Modules to copy required files (like wwwroot, views etc..) to Host projects /Modules folder. So in VS once everything is completed and deployed; folder structure will look like below;
Here you see that plugin data gets copied to [Modules] folder inside host project. Those will be copied as \Modules[plugin name]....
However in Azure this xcopy doesn't work and I cant get the copy file task to work properly. Basically there should be something which will get this done locally as well as azure pipelines without having to maintain two things (for local & pipelines)?
UPDATE-1 I removed xcopy task and tried to do everything using MSBuild copy tasks. So, the projects that require their files to be copied to host project has below in .csproj file.
<PropertyGroup>
<SolutionDirectory>$([MSBuild]::GetDirectoryNameOfFileAbove(`$(MSBuildProjectDirectory)`, `Main.Project.sln`))\</SolutionDirectory>
<PluginDirectory>$([System.IO.Path]::GetFullPath('$(SolutionDirectory)\Host.Project\Modules\$(MSBuildProjectName)'))</PluginDirectory>
</PropertyGroup>
<ItemGroup>
<ViewFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\Views'))\**\*.*"></ViewFiles>
<WWWRootFiles Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\wwwroot'))\**\*.*"></WWWRootFiles>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy
SourceFiles="@(ViewFiles)"
DestinationFolder="$(PluginDirectory)\Views\%(RecursiveDir)"
SkipUnchangedFiles="true"/>
<Copy
SourceFiles="@(WWWRootFiles)"
DestinationFolder="$(PluginDirectory)\wwwroot\%(RecursiveDir)"
SkipUnchangedFiles="true"/>
</Target>
Now this does the same thing as Xcopy did earlier. This does not give errors in Azure pipeline when building. but files are not being copied either.
Is there a way to kind of debug/troubleshoot these commands in Azure pipeline?
Since i am using MSBuild tasks to do the copying without using Pipeline tasks (exL- Copy file task), may be Azure pipelines doesn't support MSBuild tasks?