Asp .Net Core Project.json文件
问题描述:
我正在尝试创建一个.Net Core Project,它是一个NETStandard.Library版本1.6.0。Asp .Net Core Project.json文件
我想试验一个后期构建命令,但我现在注意到,在我们的project.json文件中,有一个可以创建的“后期编译”脚本。
这里是文档。 https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json
我创建了一个.cmd文件,是我从JSON文件中像这样调用:
"scripts": {
"postcompile": ["copyFiles.cmd"]
}
在我的CMD文件,我可以有一个简单的复制命令,该命令作品:
xcopy /y "C:\Playground\test.txt" "C:\Playground\test\"
什么我卡住了,是什么变量现在可以在这里给我,让我访问像构建outp ut目录?我无法在任何地方找到对此的参考。
在此先感谢。
答
完全上下文变量的列表,你可以用它来控制你的脚本流程是:
每个脚本块:具体
%project:Directory%
%project:Name%
%project:Version%
编译:
%compile:TargetFramework%
%compile:FullTargetFramework%
%compile:Configuration%
%compile:OutputFile%
%compile:OutputDir%
%compile:ResponseFile%
%compile:RuntimeOutputDir% (only available if there is runtime output)
%compile:RuntimeIdentifier% (only availabe if there is runtime output)
%comiple:CompilerExitCode% (only available in the postcompile script block)
发布具体:
%publish:ProjectPath%
%publish:Configuration%
%publish:OutputPath%
%publish:TargetFramework%
%publish:FullTargetFramework%
%publish:Runtime%
个参考文献:
https://github.com/aspnet/Home/wiki/Project.json-file#scripts
Post build event depending on configuration name in new ASP.NET 5 project
谢谢你,这是一个非常有用的列表。我注意到,如果我的脚本直接在我的json文件中,我可以得到这些工作。但是,如果我将脚本放入.cmd文件中,它不再知道%compile:OutputDir%是什么,并且我的脚本不再有效。任何线索如何让他们在cmd文件中工作? –
对不起。不知道那 – Sanket
@ C.Moore你有没有设法使用.cmd文件运行命令? – Sanket