Skip to content
New issue

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

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

Already on GitHub? # to your account

MS Build compiling csx before PreBuildEvent #109

Open
JCKodel opened this issue Jul 25, 2017 · 3 comments
Open

MS Build compiling csx before PreBuildEvent #109

JCKodel opened this issue Jul 25, 2017 · 3 comments

Comments

@JCKodel
Copy link

JCKodel commented Jul 25, 2017

I'm forced to use MSBuild stuff because CustomTool is not supported by Scripty in a .net standard project.
To use an assembly in my .csx script, I have first to copy it to the same folder as the .csx file (I'm using a PreBuild Event to do this, because .csx is in project B and the assembly I want is in project A).

The issue is: the Scripty MSBuild stuff is running before the PreBuildEvent, so, in the first time, there is no DLL copied and the .csx gives me such error. Then, when the dll is copied, it is always the not-the-latest version (because Scripty uses whatever there is in the disk and then AFTER, the PreBuildEvent is executed, thus copying the new version).

This is my .csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard1.4</TargetFramework>
  </PropertyGroup>
</Project>

This project (let's call it ProjectSample) references another .net standard 1.4 project (called Nexus).
The .csx will also use the project Nexus (it is a XML deserializer).

It is expected that Scripty runs only AFTER PreBuildEvent occurs.

@Echo-8-ERA
Copy link

Couldn't you just add a target that runs before Scripty does its thing?
e.g.:

<Target Name="CopyMyDLL" BeforeTargets="EvaluateScriptyFiles">
  <!-- Insert stuff to do the copying -->
</Target>

@JCKodel
Copy link
Author

JCKodel commented Jul 26, 2017

@Echo-8-ERA: There are no <Target> in .net standard, apparently =\ Don't know how this new .csproj works =\

@Echo-8-ERA
Copy link

Echo-8-ERA commented Jul 27, 2017

Yes there is...

Create a project file with this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <Target Name="HelloWorldTarget" BeforeTargets="BeforeBuild">
    <Message Text="Hello World!"/>
  </Target>
</Project>

Now run dotnet build /verbosity:normal and read the output

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants