I got the following error.
error MSB3073: The command "copy app.config “D:\Projects\Sdk.dll.config”
:VCEnd" exited with code 1. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113
I did not understand what error it is.
On clicking the error message, it is navigated to the [Microsoft.CppCommon.targets] file, to the following code.
<Target Name="PostBuildEvent" Condition="'$(PostBuildEventUseInBuild)'!='false'">
<Message Text="Description: %(PostBuildEvent.Message)" Condition="'%(PostBuildEvent.Message)' != '' and '%(PostBuildEvent.Command)' != ''"/>
<Exec Command="%(PostBuildEvent.Command)$(BuildSuffix)" Condition="'%(PostBuildEvent.Command)' != ''"/>
</Target>
What is the error and how can I fix it?
There is a post-build command which is trying to execute a copy that is failing. The most likely cause is a user defined command in the vcproj file which is failing. Check your projects for any block in a post-build task. That is the likely source of the error
Related
OK, bit of a weird one - I have a batch file which converts a .svg file into a header file, like so:
svg_header.bat
echo %1 -> %2
#(
echo const char *%~n1_svg = R"***(
type %~1
echo ^)***";
) > %~2
So, for example, if I have images\normal.svg I can go
svg_header.bat images\normal.svg images\normal_svg.h
And the resulting header file can be included in a C++ source file like so
#include "images\\normal_svg.h"
So far so good.
In my Visual Studio project, I have added 3 .svg files and specified a Custom Build Tool for them as follows:
The strange thing is that each time I build the project, it only works for one of the files.
So the output looks like this:
Build started...
1>------ Build started: Project: mic_muter, Configuration: Debug x64 ------
1>SVG to Header microphone_mute
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): warning MSB8065: Custom build for item "images\microphone_normal.svg" succeeded, but specified output "u:\dev\hid_kbd\mic_muter\mic_muter\images\microphone_normal_svg.h" has not been created. This may cause incremental build to work incorrectly.
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): warning MSB8065: Custom build for item "images\microphone_base.svg" succeeded, but specified output "u:\dev\hid_kbd\mic_muter\mic_muter\images\microphone_base_svg.h" has not been created. This may cause incremental build to work incorrectly.
1>mic_muter.cpp
1>U:\dev\hid_kbd\mic_muter\mic_muter\mic_muter.cpp(5,10): fatal error C1083: Cannot open include file: 'images/microphone_normal_svg.h': No such file or directory
1>Done building project "mic_muter.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
If I build the project again, the next file will be converted but the 3rd one fails with the same error. Building for a third time gets the last one and the build succeeds.
Does anyone understand what's going on here? I've tried basically every combination of all the different fields in the Custom Build Tool property page, but the same behaviour persists.
The .vcxproj section for each file is identical (apart from the source filename) and looks like this:
<CustomBuild Include="images\microphone_mute.svg">
<FileType>Document</FileType>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</DeploymentContent>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">SVG to Header %(Filename)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">SVG to Header %(Filename)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">SVG to Header %(Filename)</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">SVG to Header %(Filename)</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)images\%(Filename)_svg.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)images\%(Filename)_svg.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)images\%(Filename)_svg.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)images\%(Filename)_svg.h</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)svg_to_header.bat %(FullPath) $(ProjectDir)images\%(Filename)_svg.h</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)svg_to_header.bat %(FullPath) $(ProjectDir)images\%(Filename)_svg.h</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)svg_to_header.bat %(FullPath) $(ProjectDir)images\%(Filename)_svg.h</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)svg_to_header.bat %(FullPath) $(ProjectDir)images\%(Filename)_svg.h</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)svg_to_header.bat</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)svg_to_header.bat</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)svg_to_header.bat</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)svg_to_header.bat</AdditionalInputs>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkObjects>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkObjects>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ClInclude</OutputItemType>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ClInclude</OutputItemType>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ClInclude</OutputItemType>
<OutputItemType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ClInclude</OutputItemType>
<VerifyInputsAndOutputsExist Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</VerifyInputsAndOutputsExist>
<VerifyInputsAndOutputsExist Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</VerifyInputsAndOutputsExist>
<VerifyInputsAndOutputsExist Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</VerifyInputsAndOutputsExist>
<VerifyInputsAndOutputsExist Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</VerifyInputsAndOutputsExist>
</CustomBuild>
I'm having and issue with Visual Studio and a .NET Core API project. It's been working fine but something must have changed because I'm now getting the following output when trying to debug the project:
The program '[18032] dotnet.exe' has exited with code -2147450749 (0x80008083).
The program '[17688] iisexpress.exe' has exited with code 0 (0x0).
The program '[5500] iexplore.exe' has exited with code -1 (0xffffffff).
The event viewer is showing this error:
Failed to start process with commandline '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.exe" -debug -p "C:\Program Files (x86)\dotnet\dotnet.exe" -a "C:\Projects\Utilities\API\src\API\bin\Debug\netcoreapp1.0\API.dll" -pidFile "C:\Users\username\AppData\Local\Temp\tmp742C.tmp" -wd "C:\BlueSky\Utilities\API\src\API"', ErrorCode = '0x80004005'.
I'm not sure why this is happening, if anyone has any insight into this it would be appreciated.
Do as fallow:
Close Visual Studio
Delete the project.lock.json file (if exists)
If above step won't help then try to remove .vs folder
Open Visual Studio as Administrator (the file will be restored and you shouldn't have problems anymore)
There is also an option to use Kestrel instead of IIS Express but that's just an workaround.
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.
I have a post build step in an msbuild config which executes a powershell script. The powershell script works perfectly if I call it directly from Powershell but fails via msbuild.
It seems it fails after it tries to use classes from the import:
Import-Module WebAdministration
I get the error "Error : Retrieving the COM class factory for component with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error : 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
I've tried changing the version of powershell loaded by msbuild from 64bit to 32bit but it makes no difference.
Here is the msbuild step:
<Target Name="DevPostBuild">
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe>
<ScriptLocation Condition=" '$(ScriptLocation)'=='' ">$(ProjectDir)DevPostBuild.ps1</ScriptLocation>
</PropertyGroup>
<Message Text="$(ScriptLocation)" />
<Exec Condition="Exists($(ScriptLocation))" Command="$(PowerShellExe) -NonInteractive -executionpolicy Unrestricted -command "& { &'$(ScriptLocation)' } "" />
I'm using VS2010 on a 64bit machine.
Thanks!
Visual Studio 2010 is a 32bit process. Powershell will then run as a 32bit process. The WebAdministration module is 64bit only. Try using %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe for PowerShellExe.
Same in Visual Studio 2017, using syswow64's powershell.exe gives no difference. I had similar challenge while controlling IIS from within MSBuild XML and go same error messages about clases not registered. The Stop-WebAppPool and Stop-Website are useless therefore in MSBuild XML, as all from WebAdministration module, not mentioning Stop-IISSite from IISAdministration module.
In my case I had to utilize old good AppCmd executable from IIS. Works smooth, no issues. I also had the case when application pools and web sites are already stopped so be aware I ignore any error codes.
<Exec Command="$(WinDir)\SysWOW64\inetsrv\appcmd.exe stop apppool /apppool.name:"My Application Pool"" IgnoreExitCode="true" />
<Exec Command="$(WinDir)\SysWOW64\inetsrv\appcmd.exe stop site /site.name:"My Web Site"" IgnoreExitCode="true" />
I have some trouble with deploy from Visual Studio 2010 Professional .
This is error
Error 1 Error registering plugins and/or workflows. An unexpected
error occurred. C:\Program Files
(x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.CrmClient.targets 176 4 EPAM.Plugins.Deployment
I have found this file and 176 line.
Deploy the Plugins and Workflows using the registration file(s)
============================================================ -->
<Target Name="PluginsAndWorkflowsDeploy" Condition="'#(RegisterPlugin)' != ''">
<Message Text="WorkingFolder: $(Workingfolder)" Importance="high" />
<RegisterPlugin // this is 176 line
DiscoveryServer="$(CRMDiscoveryServer)"
Port="$(CRMDiscoveryServerPort)"
Scheme="$(CRMDiscoveryServerScheme)"
Organization="$(CRMOrganization)"
Password="$(CRMUserPassword)"
UserName="$(CRMUserName)"
Domain="$(CRMUserDomain)"
SolutionName="$(CRMSolutionName)"
RegistrationFile="%(RegisterPlugin.Identity)"
WorkingFolder="$(WorkingFolder)"
/>
</Target>
//if it is important: We use git as source control.
If you know something about this error please help.
RegisterFile.crmregister file in CRMPackage project MUST be writeable. It is possibly marked as read only by git.