Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative path in Target/ItemGroup/Content #12

Open
Jerome2606 opened this issue Oct 21, 2016 · 4 comments
Open

Relative path in Target/ItemGroup/Content #12

Jerome2606 opened this issue Oct 21, 2016 · 4 comments

Comments

@Jerome2606
Copy link

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 ?

@deadlydog
Copy link
Owner

deadlydog commented Dec 3, 2016

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
Copy link
Owner

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.

@erick-thompson
Copy link

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

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

@deadlydog
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants