Mvc icon indicating copy to clipboard operation
Mvc copied to clipboard

RC2 : project.json => postbuild

Open marcusien opened this issue 10 years ago • 12 comments

I need to use post build event so I tried to put a simple command in the postbuild attribute inside scripts. Seems to not working cause it does nothing

Any workaround or maybe i did not understand how it supposed to work

Here what I tried

"scripts": { "postbuild": [ "xcopy /Q /Y "%project:Directory%\class1.cs" "%project:Directory%\Test\class1.cs"" ] }

I attached a sample ClassLibrary1.zip

marcusien avatar Jun 07 '16 09:06 marcusien

it's postcompile now

davidfowl avatar Jun 07 '16 11:06 davidfowl

postcompile is not a valid value for scripts attribute, does not exist

marcusien avatar Jun 07 '16 12:06 marcusien

Sure it is:

https://github.com/dotnet/cli/blob/0b30b148f326dfbeeb45692a06a7d258e2fc08ad/TestAssets/TestProjects/TestAppWithScripts/project.json#L31-L36

It might be a schema issue.

davidfowl avatar Jun 07 '16 13:06 davidfowl

The schema was fixed recently https://github.com/SchemaStore/schemastore/pull/178

ajaybhargavb avatar Jun 07 '16 17:06 ajaybhargavb

Tried with postcompile and a simple xcopy still does nothing

"scripts": {
    "postcompile": [
      "xcopy /Q /Y \"C:\\Users\\User\\Documents\\doc.txt\" \"C:\\Users\\User\\Documents\\test\""
    ],
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }

The same command on "cmd" is working well

marcusien avatar Jun 08 '16 12:06 marcusien

@marcusien, I ran your sample with postcompile and I saw that xcopy is being executed. I got this output from the xcopy command

Does C:\Github\random\ClassLibrary1\Test\class1.cs specify a file name
or directory name on the target
(F = file, D = directory)?

Is this not the case when you run with postcompile instead of postbuild?

ajaybhargavb avatar Jun 13 '16 21:06 ajaybhargavb

@ajaybhargavb I just retried with my sample and just replace postbuild by postcompile and it's still not doing anything and nothing special written in the VS Output window

marcusien avatar Jun 14 '16 09:06 marcusien

I ran it in VS as well and I see this Does C:\GitHub\random\ClassLibrary1\Test\class1.cs specify a file name 1> or directory name on the target. This is from the xcopy command. Are you sure you don't see this output? Also could you try running dotnet build in command line?

ajaybhargavb avatar Jun 14 '16 17:06 ajaybhargavb

Yes I'm sure I don't see it in the output ^^

However, I tried running dotnet build on my project directory from "cmd" and I see the message "Does ... specify a file name...or directory name on the target".

It could mean that my VS does not use dotnet build to build my xproj ?

marcusien avatar Jun 15 '16 15:06 marcusien

@marcusien It make sense to move this to dotnet/cli, it's not an MVC issue.

davidfowl avatar Jun 15 '16 15:06 davidfowl

So what should I do ? :)

marcusien avatar Jun 16 '16 07:06 marcusien

@marcusien, I suspect this is just a path issue. VS might be using a really old version of dotnet. Check your Path and see if it has the location of latest dotnet. Also, could you file this issue in https://github.com/dotnet/cli/issues? This is completely unrelated to MVC.

ajaybhargavb avatar Jun 16 '16 17:06 ajaybhargavb