Build FAILED for Notepad++ with message PostBuildEvent: The system cannot find the file specified - visual-studio-2010

I get a build failure due to a post build event failure when building Notepad++ in VS 2010.
Here's the message from Output window:
PostBuildEvent:
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "copy ..\src\config.xml ..\bin\config.xml
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: copy ..\src\langs.xml ..\bin\langs.xml
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: copy ..\src\stylers.xml ..\bin\stylers.xml
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073:
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.
Please help

Posting the answer for others who might run into this issue
After a little research on this subject,
I learned that the XML file names that are specified in the projects Post-Build Event have changed, so you have to update that to use the new file-names
You can fix this by modifying the project file like this:
In Visual Studio,
Select the Project (Notepad++) and choose Project > Properties from VS Menu (or hit ALT + F7)
In the Property Pages window,
expand the Configuration Properties node
then, expand the Build Events node
Select Post-Build Event to view its properties
Modify the Command Line Property to look like this:
copy ..\src\config.model.xml ..\bin\config.model.xml
copy ..\src\langs.model.xml ..\bin\langs.model.xml
copy ..\src\stylers.model.xml ..\bin\stylers.model.xml
Click OK and Build away...

Also, be careful of spaces in the path. I just wasted a half hour convincing myself that the paths in a Pre-Build copy step were indeed correct (they were).
Got bitten by spaces in the path. Instead of copy d:\a path\*.dll d:\b path\ you want to quote it, like this:
copy "d:\a path\\*.dll" "d:\b path\"

Not specific to Notepad++ but I had a similar problem with a recent post-build step. When you see...
PostBuildEvent: The system cannot find the file specified.
..your source path is wrong. In my case I was using the wrong relative source path. And this fixed it:
copy /Y $(TargetName).* $(ProjectDir)..\Latest

Related

Can't add Embree to my project, getting LNK1104 error

I'm trying to add Embree to an already working solution, following this resource I've added to my CMakeLists.txt file the following:
FIND_PACKAGE(embree 3.0 REQUIRED)
INCLUDE_DIRECTORIES(${EMBREE_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(application ${EMBREE_LIBRARY})
I've also created a Windows environment variable embree_DIR with my Embree installation folder ("C:\Program Files\Intel\Embree3 x64").
CMake configures the solution fine, but when I build I get a fatal error LNK1104: impossible to open 'embree3.lib'.
Just so you know, I actually have a C:\Program Files\Intel\Embree3 x64\lib\embree3.lib file.
Anyone has any clue why this might be happening?
Set EMBREE_ROOT_DIR e.g.:
set(EMBREE_ROOT_DIR "C:/thirdparty/vs2017/x64/embree-2.17.0")
Link to ${EMBREE_LIBRARIES}
target_link_libraries(YourApp
...
${EMBREE_LIBRARIES}
...
)

Trying to Add a Reference to Visual Studio Project Suddenly Throws an Exception

When I try to ADD a REFERENCE to any Visual Studio project...I am suddenly getting the following exception:
Error HRESULT E_FAIL has been returned from a call to a COM component
This happens across ALL projects regardless of whether they are source-controlled (or not)
SIDE NOTE:
I did recently install Xamarin on a SEPARATE PROJECT in another TFS SOLUTION
WHAT I'VE DONE SO FAR:
Delete all *.suo files
Delete all *.user files
Wiped the TFS Workspace & done a FORCE GET
Nothing has worked
The FIRST TIME you get this error message you'll get a window with a reference to the following file:
ActivityLog.xml: This file contains information about the underlying error.
If you ignore the message & click away from the initial dialog, THE ERROR GETS SUPPRESSED and is replaced with:
Error HRESULT E_FAIL has been returned from a call to a COM component.
If you look in this file you will see the error. This particular exception was was caused by:
Microsoft.visualstudio.shell.interop.IVsReferenceManager2
Within the Microsoft.VisualStudio.Shell.Interop.11.0.dll library.
This post helped me solve the issue!
THE FIX IS:
Open "Developer Command Prompt for VS 2017" as an Administraor
CD into "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"
After a restart, it all worked well.

Windows Driver build - incorrect path passed to Inf2Cat.exe

I'm new to the subject of windows drivers. I'm trying to build one of the Windows-driver-samples in Visual Studio 2015. The compilation and linking steps pass without errors and then I get the following error:
TRACKER : error TRK0002: Failed to execute command:
""C:\Program Files (x86)\Windows Kits\10\bin\x86\inf2cat.exe"
/os:10_x64 /driver:x64\Debug\WFPSamplerCalloutDriver\".
The operation identifier is not valid.
(Note the relative path in /driver argument). If I call Inf2Cat manually from command prompt with full path to the driver, it passes without a hitch:
C:\Program Files (x86)\Windows Kits\10\bin\x86>Inf2Cat.exe /os:10_x64
/driver:C:\Users\****\Windows-driver-samples\network\trans\WFPSampler\sys\x64\Debug\W
FPSamplerCalloutDriver
...........................
Signability test complete.
Errors:
None
Warnings:
None
Catalog generation complete.
C:\Users\****\Windows-driver-samples\network\trans\WFPSampler\sys\x64\Debug
\WFPSamplerCalloutDriver\wfpsamplercalloutdriver.cat
So, it seems to me that VS somehow failed to provide the full path to the driver in the argument to Inf2Cat.
How can I fix this? Which configuration property of my project is incorrect?
Description
Seems Inf2Cat from SDK10 does not accept directory path format provided by VS Project Configurator. Works when: either output folder name has with no trailing "\" or folder name ends up with "\.".
Workaroud
Disable Inf2Cat under Project Preferences: Run Inf2Cat -> No
Configure build events under Build-Events->Post Build-Event: Command Line -> "$(WindowsSdkDir)bin\$(DDKPlatform)\inf2cat.exe" /os:10_$(DDKPlatform) /driver:"$(ProjectDir)$(IntDir)$(MSBuildProjectName)"

error MSB3073: The command "call "C:\project\clientdll\dependencies\gitrev.bat" :VCEnd" exited with code 255

I'm getting this message when trying to build my project (Visual Studio 2010):
Error 120 error MSB3073: The command "call "C:\project\clientdll\dependencies\gitrev.bat"
:VCEnd" exited with code 255.
Yes, the file does exist, I used this command in Pre build event, it looks like this:
call "$(SolutionDir)dependencies\gitrev.bat"
Any ideas?
Your Visual Studio is probably not openend with sufficient privileges. Open as admin and try again.
1) right click on Visual Studio Icon
2) choose run as administrator
3) In Start page choose your application.
4) Clean solution
5) Verify if outputs are removed and that the bat file is present in location
6) Rebuild solution
7) Check for errors again.
I had the same error when forgot to add the "call" prefix before the label:
(
...
:MYLABEL blablabla
...
)
The "(:" sequence basically will output the "Continue?" in the opened console window. Seems the Visual Studio does some track of what kind of cmd.exe behaviour and immediately stops the cmd.exe process with the 255 error.
I've had another error like:
error MSB3073: :VCEnd" exited with code -1.
Where the reason of this was the script output of another sequence (only in Visual Studio 2010 and higher):
... error ... :
Well, the Visual Studio tries to guess there the script behaves badly and stops it with these kind of errors.

Vim errorformat for Visual Studio

I want to use Vim's quickfix features with the output from Visual Studio's devenv build process or msbuild.
I've created a batch file called build.bat which executes the devenv build like this:
devenv MySln.sln /Build Debug
In vim I've pointed the :make command to that batch file:
:set makeprg=build.bat
When I now run :make, the build executes successfully, however the errors don't get parsed out. So if I run :cl or :cn I just end up seeing all the output from devenv /Build. I should see only the errors.
I've tried a number of different errorformat settings that I've found on various sites around the net, but none of them have parsed out the errors correctly. Here's a few I've tried:
set errorformat=%*\\d>%f(%l)\ :\ %t%[A-z]%#\ %m
set errorformat=\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m
set errorformat=%f(%l,%c):\ error\ %n:\ %f
And of course I've tried Vim's default.
Here's some example output from the build.bat:
C:\TFS\KwB Projects\Thingy>devenv Thingy.sln /Build Debug
Microsoft (R) Visual Studio Version 9.0.30729.1.
Copyright (C) Microsoft Corp. All rights reserved.
------ Build started: Project: Thingy, Configuration: Debug Any CPU ------
c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Linq.dll" /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\UIAutomationProvider.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Thingy.exe /resource:obj\Debug\Thingy.g.resources /resource:obj\Debug\Thingy.Properties.Resources.resources /target:winexe App.xaml.cs Controller\FieldFactory.cs Controller\UserInfo.cs Data\ThingGatewaySqlDirect.cs Data\ThingListFetcher.cs Data\UserListFetcher.cs Gui\FieldList.xaml.cs Interfaces\IList.cs Interfaces\IListFetcher.cs Model\ComboBoxField.cs Model\ListValue.cs Model\ThingType.cs Interfaces\IThingGateway.cs Model\Field.cs Model\TextBoxField.cs Model\Thing.cs Gui\MainWindow.xaml.cs Gui\ThingWindow.xaml.cs Interfaces\IField.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs Properties\Settings.Designer.cs RequiredValidation.cs "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\Gui\FieldList.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\Gui\MainWindow.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\Gui\ThingWindow.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\App.g.cs" "C:\TFS\KwB Projects\Thingy\Thingy\obj\Debug\GeneratedInternalTypeHelper.g.cs"
C:\TFS\KwB Projects\Thingy\Thingy\Controller\FieldFactory.cs(14,19): error CS0246: The type or namespace name 'IFieldNothing' could not be found (are you missing a using directive or an assembly reference?)
Compile complete -- 1 errors, 0 warnings
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
UPDATE:
It looks like using msbuild instead of devenv is probably the right way to go (as per Jay's comment).
Using msbuild the makeprg would be:
:set makeprg=msbuild\ /nologo\ /v:q
Sample output whould be:
Controller\FieldFactory.cs(14,19): error CS0246: The type or namespace name 'IFieldNothing' could not be found (are you missing a using directive or an assembly reference?)
It looks like the tricky part here may lie in the fact that the path is relative to the .csproj file, not the .sln file which is the current directory in Vim and lies one directory above the .csproj file.
ANSWER:
I figured it out...
set errorformat=\ %#%f(%l\\\,%c):\ %m
This will capture the output for both devenv /Build and msbuild.
However, msbuild has one catch. By default, it's output doesn't include full paths. To fix this you have to add the following line to your csproj file's main PropertyGroup:
<GenerateFullPaths>True</GenerateFullPaths>
I have a blog post which walks through all the details of getting C# projects building in Vim, including the error format. You can find it here: http://kevin-berridge.blogspot.com/2008/09/vim-c-compiling.html
In short you need the following:
:set errorformat=\ %#%f(%l\\\,%c):\ %m
:set makeprg=msbuild\ /nologo\ /v:q\ /property:GenerateFullPaths=true
Copy from question to remove from 'unanswered' list
set errorformat=\ %#%f(%l\\\,%c):\ %m
This will capture the output for both devenv /Build and msbuild. However, msbuild has one catch. By default, it's output doesn't include full paths. To fix this you have to add the following line to your csproj file's main PropertyGroup:
<GenerateFullPaths>True</GenerateFullPaths>
I found an even better answer: use :compiler to use built-in efm settings.
" Microsoft C#
compiler cs
" Microsoft Visual C++
compiler msvc
" mono
compiler mcs
" gcc
compiler gcc
Note: It also sets the default makeprg. See $VIMRUNTIME/compiler/
Try running msbuild instead of devenv. This will open up a ton of power in how the build runs.
Open a Visual Studio Command Prompt to get your path set up. Then do msbuild MySln.sln /Configuration:Debug.
See msbuild /? for help.
I found this question when looking for errorformat for compiling c++ in Visual Studio. The above answers don't work for me (I'm not using MSBuild either).
I figured out this from this Vim Tip and :help errorformat:
" filename(line) : error|warning|fatal error C0000: message
set errorformat=\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %[A-Z\ ]%#%n:\ %m
Which will give you a quickfix looking like this:
stats.cpp|604 error 2039| 'getMedian' : is not a member of 'Stats'
(with error highlighted) from
c:\p4\main\stats.cpp(604) : error C2039: 'getMedian' : is not a member of 'Stats'
As Simon Buchan mentioned you can use this in your project to generate the full paths in the output:
<GenerateFullPaths>True</GenerateFullPaths>
But you can make it more portable by adding /property:GenerateFullPaths=true to you makeprg instead of adding the above to your project files.
:set makeprg=msbuild\ /nologo\ /v:q\ /property:GenerateFullPaths=true\
None of these errorformats worked in Visual studio 2009 v9.0.21022.8 professional edition. Using cygwin, had to call devenv from bash which made setting makeprg a little tricky (screw batch files). Also had to tweak my errorformat when devenv splits into multiple processes and proceeds error message with "1>" or "2>" etc:
set autowrite
"2>c:\cygwin\home\user\proj/blah.cpp(1657) : error C2065: 'blah' : undeclared identifier
set errorformat=%.%#>\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %[A-Z\ ]%#%n:\ %m
let prg="devenv"
let makepath=$MAKEPATH
let &makeprg='cmd /c "'.prg.' '.makepath.'"'
My .bashrc sets the MAKEPATH environment variable using cygpath to convert to a DOS compatible path:
export MAKEPATH="$(cygpath -d "proj/VC9/some.sln") /build \"Debug\""
If you have vim 6.x you can use :cw which is SO much better than clist (try searching for errors among hundreds of warnings and you know what I mean). Looking at vim tweaks makes me want to vomit but I'm in vim heaven!!! Good bye visual studio! Thanks for the base to tweak pydave +1.

Resources