Sdk: Pre/Post restore script does not run

Created on 8 Jun 2016  路  5Comments  路  Source: dotnet/sdk

Steps to reproduce

have a project.json file with

"scripts": {
        "postrestore": ["npm install"],

run dotnet restore

Expected behavior

npm install to run and node packages are restored. As it was before in RC1.

Actual behavior

npm install does not run no matter if you use prerestore, postrestore, npm install as an [] or not.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
 Version:     1.0.0-preview1-002702
 Commit Sha:  6cde21225e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

Most helpful comment

@piotrpMSFT how about documenting that for RC2? cause right now docs are misleading and project.json do has those in schema

All 5 comments

dotnet does not support pre/post-restore events. The extensibility model is going to undergo some redesign for RTM and this may become available in that timeframe.

@piotrpMSFT how about documenting that for RC2? cause right now docs are misleading and project.json do has those in schema

@piotrpMSFT @blackdwarf I just ran into this. I need prerestore for my _new and most excellent_ project.json to .csproj .NET Core tooling ... for goofballs who will want to go on working with a JSON project config file when we move to MSBuild. It actually :tada: works! :tada: ...

However, it will never work well if I can't trigger the tool to run prerestore. Is there a workaround? If not, why isn't this a higher priority? I have a feeling many devs will want to do pre/postrestore things.

Also, I agree with @dlebedynskyi ... The docs and schema for project.json say that pre/postrestore are there.

[EDIT] Here's the tooling that would require prerestore to work well: https://github.com/GuardRex/GuardRex.JsonToCsprojConverter

@GuardRex it is really disappointing that they broken this in RC2. thanks for tool thought.
For any dev that is used to npm as example this change is like shot in a leg from microsoft.
Wish they actually did prioritize this instead all closing issues.

@dlebedynskyi I'm surprised on this one.

I guess a workaround in my case is to put a Gulp watch on the project2.json test file so that when I mod the file, my console app is called to run, which will then immediately re-create the .csproj file.

At least I have a workaround, but I am a bit surprised that getting all of the script calls working for RTM wasn't a higher priority.

Was this page helpful?
0 / 5 - 0 ratings