我为.NET框架构建了一个WPF程序。为了使程序正确工作,我需要运行下面的cor频命令。
corflags c:/[file location]/[file name].exe /32BITREQ+现在我通过visual控制台手动完成这个操作,但是我想在构建完成后自动完成。这有可能吗?
我试着四处寻找解决方案,但却找不到。我的最佳猜测是在构建后事件命令行中使用一个命令。我试着跟着。
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\corflags.exe" "$(ProjectDir)bin\$(ConfigurationName)\QardPrint.exe" /32BITREQ+这会产生以下错误。在输出窗口中。
1>Target "PostBuildEvent: (TargetId:81)" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets" from project "H:\VSWorkspace\VSTS\Quantore\LoginQard\QardPrint\QardPrint.csproj" (target "CoreBuild" depends on it):
1>Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "Exec" (TaskId:58)
1> Task Parameter:WorkingDirectory=bin\x86\Debug\ (TaskId:58)
1> Task Parameter:Command="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\corflags.exe" "H:\VSWorkspace\VSTS\Quantore\LoginQard\QardPrint\bin\Debug\QardPrint.exe" /32BITREQ+ (TaskId:58)
1> "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\corflags.exe" "H:\VSWorkspace\VSTS\Quantore\LoginQard\QardPrint\bin\Debug\QardPrint.exe" /32BITREQ+ (TaskId:58)
1> Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.6.1055.0 (TaskId:58)
1> Copyright (c) Microsoft Corporation. All rights reserved. (TaskId:58)
1> (TaskId:58)
1>corflags : error CF001: Could not open file for writing
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5019,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\corflags.exe" "H:\VSWorkspace\VSTS\Quantore\LoginQard\QardPrint\bin\Debug\QardPrint.exe" /32BITREQ+" exited with code 1.
1>Done executing task "Exec" -- FAILED. (TaskId:58)在错误列表中
Could not open file for writing QardPrint H:\VSWorkspace\VSTS\Quantore\LoginQard\QardPrint\corflags我并没有直接使用旗号,而是尝试了以下几点:汉斯·帕桑在评论中提出的建议。
这没有解决我与oracle连接(9.2版)的错误。我的手动旗号命令确实解决了这个问题。
发布于 2017-09-15 06:38:43
这没有解决我与oracle连接(9.2版)的错误。我的手动旗号命令确实解决了这个问题。
您需要注意命令行中QardPrint.exe的路径,在您更改Build->General-->Platform目标设置为x86 Build->Platform= x86之后。
将平台目标更改为x86之后,QardPrint.exe是在x86文件夹中生成的:
$(ProjectDir)bin\x86\$(ConfigurationName)\QardPrint.exe如果您不更改命令行"$(ProjectDir)bin\$(ConfigurationName)\QardPrint.exe“中的前一条路径,您将得到该错误。前面的命令行也有相同的错误:

如果我纠正了这条路,所有的东西都能正常工作。
希望这能有所帮助。
https://stackoverflow.com/questions/46215778
复制相似问题