Skip to content

Relative path in Target/ItemGroup/Content #12

@Jerome2606

Description

@Jerome2606

Hello,

I try to make this part from my .csproj working:

<Target Name="CustomPostAfterBuild" AfterTargets="AfterBuild">
    <Exec Command="echo Post-Build event: Active configuration is: $(ConfigurationName)" />
    <PropertyGroup>
        <EmptyCheck>Scripts\dist\*.js</EmptyCheck>
    </PropertyGroup>
    <Error Condition="'@(EmptyCheck)' == ''" Text="Empty folder $(EmptyCheck)" />
    <ItemGroup>
      <!-- what ever is in the build folder should be included in the project -->
      <Content Include="Scripts\dist\*.js" />
      <!--<Content Include="$(MSBuildThisFileDirectory)Scripts\dist\*.js" />-->
    </ItemGroup>
  </Target>

When I publish my project from visual studio it is ok.
But when I use Invoke-MsBuild from my powershell script it fails.

I got the same problem with my Gulp task but I fixed it by using absolute path.

It's not possible for ItemGroup/Content

Is it a way for command line Invoke-MsBuild to be based on current project publishing ?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions