VS2015 devenv.exe 在 post 构建事件中以代码 1 退出

VS2015 devenv.exe exited with code 1 in post build event

我有一个用VS2015打开的VC++ 2012项目。我的电脑上安装了VS2012和VS2015。我添加了 post 构建事件:

devenv.exe "$(SolutionPath)" /Build "$(Configuration)Dll|$(Platform)" /Project "$(ProjectPath)"

评估值为:

devenv.exe "C:\Users\Wang-Tzu-Chao\Documents\Visual Studio 2015\Projects\KORAT\NCUTAS.sln" /Build "DebugDll|x64" /Project "C:\Users\Wang-Tzu-Chao\Documents\Visual Studio 2015\Projects\KORAT\OCRScan\TinyOCR.vcxproj"

在我右击项目->重建后,我一直收到以下错误:

Error MSB3073 The command "devenv.exe "C:\Users\Wang-Tzu-Chao\Documents\Visual Studio 2015\Projects\KORAT\NCUTAS.sln" /Build "DebugDll|x64" /Project "C:\Users\Wang-Tzu-Chao\Documents\Visual Studio 2015\Projects\KORAT\OCRScan\TinyOCR.vcxproj" :VCEnd" exited with code 1. ocrscan C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets 134

错误 XML 日志如下所示:

<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="ActivityLog.xsl"?>
<activity>
  <entry>
    <record>1</record>
    <time>2017/02/21 15:42:45.240</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Microsoft Visual Studio 2012 version: 11.0.50727.1</description>
  </entry>
  <entry>
    <record>2</record>
    <time>2017/02/21 15:42:45.240</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Running in User Groups: Administrators Users</description>
  </entry>
  <entry>
    <record>3</record>
    <time>2017/02/21 15:42:45.240</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Available Drive Space: C:\ drive has 170573537280 bytes; D:\ drive has 407639183360 bytes</description>
  </entry>
  <entry>
    <record>4</record>
    <time>2017/02/21 15:42:45.241</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Internet Explorer Version: 11.0.14393.693</description>
  </entry>
  <entry>
    <record>5</record>
    <time>2017/02/21 15:42:45.241</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>.NET Framework Version: 10.0.14393.0</description>
  </entry>
  <entry>
    <record>6</record>
    <time>2017/02/21 15:42:45.242</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>MSXML Version: 6.30.14393.321</description>
  </entry>
  <entry>
    <record>7</record>
    <time>2017/02/21 15:42:45.242</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Creating PkgDefCacheNonVolatile</description>
  </entry>
  <entry>
    <record>8</record>
    <time>2017/02/21 15:42:45.247</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Double-checking master pkgdef file</description>
  </entry>
  <entry>
    <record>9</record>
    <time>2017/02/21 15:42:45.249</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>PkgDefManagement initialized</description>
  </entry>
  <entry>
    <record>10</record>
    <time>2017/02/21 15:42:45.249</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>RootFolder</description>
    <path>C:\Program Files (x86)\Microsoft Visual Studio 11.0\</path>
  </entry>
  <entry>
    <record>11</record>
    <time>2017/02/21 15:42:45.249</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>ShellFolder</description>
    <path>C:\Program Files (x86)\Microsoft Visual Studio 11.0\</path>
  </entry>
  <entry>
    <record>12</record>
    <time>2017/02/21 15:42:45.249</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>PkgDefSearchPath</description>
    <path>C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.admin.pkgdef</path>
  </entry>
  <entry>
    <record>13</record>
    <time>2017/02/21 15:42:45.249</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>ApplicationExtensionsFolder</description>
    <path>C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions</path>
  </entry>
  <entry>
    <record>14</record>
    <time>2017/02/21 15:42:45.249</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>&quot;ZeroImpact&quot; = dword:0, &quot;MergeRegistry&quot; = dword:1</description>
  </entry>
  <entry>
    <record>15</record>
    <time>2017/02/21 15:42:45.250</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Could not find ConfigurationChanged timestamp.</description>
    <hr>80070002</hr>
  </entry>
  <entry>
    <record>16</record>
    <time>2017/02/21 15:42:45.250</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>User extensions enabled by setting</description>
    <path>HKEY_CURRENT_USER\Software\Microsoft\VisualStudio.0\ExtensionManager\EnableAdminExtensions</path>
  </entry>
  <entry>
    <record>17</record>
    <time>2017/02/21 15:42:45.250</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Could not find ConfigurationChanged timestamp.</description>
    <hr>80070002</hr>
  </entry>
  <entry>
    <record>18</record>
    <time>2017/02/21 15:42:45.250</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>PkgDefManagement startup complete</description>
  </entry>
  <entry>
    <record>19</record>
    <time>2017/02/21 15:42:45.251</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Configuration file to be used for CLR initialization</description>
    <path>C:\Users\Wang-Tzu-Chao\AppData\Local\Microsoft\VisualStudio.0\devenv.exe.config</path>
  </entry>
  <entry>
    <record>20</record>
    <time>2017/02/21 15:42:45.251</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>AppId setting up registry detouring</description>
  </entry>
  <entry>
    <record>21</record>
    <time>2017/02/21 15:42:45.251</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Adding detour rule 1: from HKLM</description>
    <path>Software\Microsoft\VisualStudio.0</path>
  </entry>
  <entry>
    <record>22</record>
    <time>2017/02/21 15:42:45.251</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Detour to HKCU</description>
    <path>Software\Microsoft\VisualStudio.0_Config</path>
  </entry>
  <entry>
    <record>23</record>
    <time>2017/02/21 15:42:45.251</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Adding detour rule 2: from HKLM</description>
    <path>Software\Microsoft\VisualStudio.0</path>
  </entry>
  <entry>
    <record>24</record>
    <time>2017/02/21 15:42:45.251</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Detour to HKCU</description>
    <path>Software\Microsoft\VisualStudio.0_Config</path>
  </entry>
  <entry>
    <record>25</record>
    <time>2017/02/21 15:42:45.251</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>AppId starting registry detouring</description>
  </entry>
  <entry>
    <record>26</record>
    <time>2017/02/21 15:42:45.264</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>AppId stopped registry detouring</description>
  </entry>
  <entry>
    <record>27</record>
    <time>2017/02/21 15:42:45.264</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Shutting down pkgdef registry</description>
  </entry>
  <entry>
    <record>28</record>
    <time>2017/02/21 15:42:45.264</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Released pkgdef cache usage tracker</description>
  </entry>
  <entry>
    <record>29</record>
    <time>2017/02/21 15:42:45.264</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>PkgDef registry shutdown complete</description>
  </entry>
</activity>

我需要你的帮助,谢谢!

将命令更改为以下格式后,一切正常:

"$(DevEnvDir)devenv.exe" /Build "DebugDll|x64" /Project "$(ProjectName)" "$(ProjectPath)"

DebugDll|x64 是添加到 VC2012 项目的自定义构建配置。