Invoke-MsBuild icon indicating copy to clipboard operation
Invoke-MsBuild copied to clipboard

Relative path in Target/ItemGroup/Content

Open Jerome2606 opened this issue 8 years ago • 4 comments

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 ?

Jerome2606 avatar Oct 21 '16 12:10 Jerome2606

Sorry it took so long for me to see this. Apparently I didn't have my notifications configured properly in GitHub :(

Are you able to reproduce the problem when just using msbuild.exe directly without Invoke-MsBuild? I assume there is just an extra parameter that needs to get passed to msbuild.exe.

Invoke-MsBuild will let you pass additional parameters to the msbuild.exe via the MsBuildParameters parameter.

deadlydog avatar Dec 03 '16 18:12 deadlydog

Hmmm, since I run MSBuild.exe from a new command prompt window, I may actually need to allow you to pass in a "working directory" parameter, and cd into that path before calling MSBuild.exe so that it uses it as the working directory. If you are still having this problem, or others have a need for this functionality, I'll look at adding it.

deadlydog avatar Apr 20 '17 07:04 deadlydog

This is something that would be very useful to me as well.

Thanks for building this module, it makes working with msbuild much easier.

erick-thompson avatar Dec 05 '17 23:12 erick-thompson

That should be a fairly easy change to make, I'm just not sure when I'll have time to do it (my personal projects have been suffering lately as I've gotten busier at work). I'll try to get to it, but if you can submit a PR for it I could get a new version pushed out pretty quickly. Thanks.

deadlydog avatar Dec 06 '17 22:12 deadlydog