Asp .Net Core Project.json文件

时间:2016-08-22 04:55:46

标签: json asp.net-core .net-core asp.net-core-1.0

我正在尝试创建.Net核心项目,这是一个NETStandard.Library版本1.6.0。

我想尝试一下post build命令,但我现在注意到在我们的project.json文件中,有一个可以创建的“postcompile”脚本。

这是文档。 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\"

我所坚持的是,此时我现在可以使用哪些变量,让我可以访问构建输出目录等内容?我无法在任何地方找到这方面的参考。

提前致谢。

1 个答案:

答案 0 :(得分:4)

可用于控制脚本流程的上下文变量的完整列表如下:

每个脚本块:

%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

相关问题