Asp .Net 核心 Project.json 文件

Asp .Net Core Project.json File

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

我想尝试使用 post 构建命令,但我现在注意到在我们的 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\"

我坚持的是什么变量现在对我可用,让我访问构建输出目录之类的东西?我在任何地方都找不到对此的引用。

提前致谢。

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

每个脚本块:

%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