生成后事件

 1       @echo off & setLocal EnableDELAYedeXpansion
 2       chcp 65001
 3 
 4       set errorCode=0
 5 
 6       set target=$(TargetPath)
 7       set project=$(ProjectPath)
 8 
 9       set sdk=%PROGRAMFILES(x86)%Microsoft SDKsWindowsv8.1AinNETFX 4.5.2 Tools
10       set framework=%WINDIR%Microsoft.NETFrameworkv4.5.2
11       set inlineILCompiler=$(SolutionDir)ToolsInlineILCompilerInlineILCompilerin$(ConfigurationName)InlineILCompiler.exe
12       set cscli=$(SolutionDir)ToolsCSCliin$(ConfigurationName)CSCli.exe
13 
14       IF exist "%sdk%." (
15       echo OK: The Microsoft Windows SDK was found.
16       ) else (
17       echo FAILED: The Microsoft Windows SDK Dir was not found. Check the following path: "%sdk%"
18       goto EXIT_ERR
19       )
20       IF exist "%framework%." (
21       echo OK: The .NET Framework Dir was found.
22       ) else (
23       echo FAILED: The Framework-Dir was not found. Check the following path: "%framework%"
24       goto EXIT_ERR
25       )
26       IF exist "%inlineILCompiler%" (
27       echo OK: Found the inline-il-compiler.
28       ) else (
29       echo FAILED: The inline-il-compiler was not found. Check the following path: "%inlineILCompiler%"
30       goto EXIT_ERR
31       )
32       IF exist "%cscli%" (
33       echo OK: Found the cscli-compiler.
34       ) else (
35       echo FAILED: The cscli was not found. Check the following path: "%cscli%"
36       goto EXIT_ERR
37       )
38 
39       if $(ConfigurationName) == Debug (
40       echo Build-Configuration: DEBUG
41       echo    DEBUG=IMPL
42       echo    NO OPTIMIZE
43       set ilasm_args=/DLL /DEBUG=IMPL
44       ) else (
45       if $(ConfigurationName) == Release (
46       echo Build-Configuration: RELEASE
47       echo    NO DEBUG
48       echo    OPTIMIZE
49       set ilasm_args=/DLL /OPTIMIZE
50       ) else (
51       echo FAILED: Invalid Configuration.
52       goto EXIT_ERR
53       )
54       )
55 
56       echo.
57       echo.
58       echo Calling the inline-il-compiler ...
59       call "%inlineILCompiler%"
60 
61       echo.
62       echo.
63       echo Calling CSCli ...
64       call "%cscli%" -file:"$(TargetPath)" -r:"RemoveObjAttribute" -c:"CSCalliAttribute"
65 
66       :EXIT
67       EXIT /B %errorCode%
68 
69       :EXIT_ERR
70       set errorCode=-1
71       goto EXIT
原文地址:https://www.cnblogs.com/endv/p/6101843.html