As much as this topic has been talked about, I would think that someone else has run into the same issue as me and found a solution.
This XCOPY Script works in another environment using VS 2012 (with macros) and the same environment using the command line.
XCOPY "C:\Web.Forms\bin\Web.Forms.dll" "C:\inetpub\WebSite\bin" /Y /R
XCOPY "C:\Web.Forms\UserControls\*.ascx" "C:\inetpub\WebSite\usercontrols" /Y /R
It keeps throwing an error of 4 and does not copy within VS 2013. If I change it to "COPY" I get an error of 1. For the purpose of testing and to use it in the command line I stripped it of all Macro's. Actually, I used the [macro] generated directory strings from the error message successfully in the command line.
So why doesn't this work in Visual Studio 2013? VS is running as Administrator.
Related
I'm tyring to copy a folder from my Visual Studio 2015 Project's root directory into the output directory (as it breaks the application without it), so I decided to add xcopy to the post-build commands.
xcopy "$(SolutionDir)Content\*.*" "$(TargetDir)Content\" /s /i /y
I'm getting the following when it runs, and right now I can't even test this application because of xcopy.
1> File not found - *.*
1> 0 File(s) copied
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command "xcopy "E:\Data\Projects\Vessel\Games\TheThing\Content\*.*" "E:\Data\Projects\Vessel\Games\TheThing\TheThing\bin\DesktopGL\AnyCPU\Debug\Content\" /s /i /y" exited with code 4.
I'm also getting problems with Xcopy and postbuild events in visual studio from time to time.
My fix is generally to create a batch script which contains the xcopy.
The batch script then is called by:
call "$(SolutionDir)scripts\copyfiles.bat"
as a post script event.
I am using Visual Studio 2013 Ultimate Update 5
I was using successfully vsDiffMerge.exe as the diff and merge tool both in Sourcetree as well as from command line (using the /t and the /m options)
All of a sudden (only thing I can note is Windows update "KB4015217") the vsDiffMerge stopped working in case of merge (the /m option) and instead it started behaving as if it is an automated merge followed by a diff !!
The command line syntax
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsDiffMerge.exe" "$fremote" "$flocal" "$fbase" "$fmerge" /m /t
would generate a strange window such as this
Output of the vsDiffMerge.exe with the /m /t option, same if we use only /m
We have tried all the tricks in the book: devenv /resetuserdata , reset all settings from import/export, reset Window layout, and doing a complete VS Repair
Any suggestion how to go about solving this problem ?
We ended moving to P4Merge to get a working tool for this.
I will close this thread.
I have next pre build event:
cmd /C mklink /D /J "$(ProjectDir)SomeDir" "$(ProjectDir)"
This is expanded in(copied from MSBuild output):
cmd /C mklink /D /J "C:\Dir-1\Dir-2\other-dirs-here\SomeDir" "C:\Dir-1\Dir-2\other-dirs-here\"
When running the build with this build event the symbolic link is not created, but when I copy exactly the expanded output of Visual Studio in command line the link is created.
Do you know why?
EDIT: I have administrator rights on the computer. Both Visual Studio and Command Prompt have "Administrator" on top
Found the problem - the previous command in the build event was:
$(ANDROID_HOME)/tools/android.bat update project my-project-settings
and for some weird reasons prevented all commands after it to run...
I've converted an old Visual C++ 6.0 project to a new Visual C++ 2010 one. It functions but I have a problem with the post build event which I took from the old project. It registered the target file (an .ocx) on the computer:
copy $(ProjDir)\PDFXChange\dll.Debug\*.* $(TargetDir)
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
In my new solution it doesn't work. I've also tested it in single commands: of the three commands (copy, regsvr32 and echo) only the last one could be executed. What could be my error.
Error:
error MSB3073: The command "copy \PDFXChange\dll.Debug\*.* C:\_tests_\ocx2010\Debug\
regsvr32 /s /c "C:\_tests_\ocx2010\.\Debug\LayoutBox.dll"
echo regsvr32 exec. time > ".\Debug\\regsvr32.trg"
:VCEnd" exited with code 3. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets
COPY and REGSVR32 seem not to work.
The problem was in the name of the macro $(ProjDir). In Visual C++ 2010 it's $(ProjectDir)
$(ProjDir) -> $(Proj ect Dir)
Some macros altered their names (after so many years)!
The command copy \PDFXChange\dll.Debug*.* C:tests\ocx2010\Debug should copy some DLLs into the folder where the next command regsvr32 /s /c "C:tests\ocx2010.\Debug\LayoutBox.dll tried to register the target file. It couldn't find any DLLs there, so it quit with the error message.
Mismatch between
Project->Properties->Configuration Properties->General->Output Directory
and
Project->Properties->Configuration->Linker->Output File
I made the former like so...
$(SolutionDir)$(PlatformTarget)$(Configuration)\
and in the linker like so..
$(SolutionDir)$(PlatformTarget)$(Configuration)$(ProjectName).dll
and it solved the problem
I'm trying to auto sign project with certificate using signtool.exe in Visual Studio 2010. Here is my simplified post-build script:
if $(ConfigurationName) == Debug (
call "$(VS100COMNTOOLS)VCVarsQueryRegistry.bat"
call "$(WindowsSdkDir)bin/signtool.exe" sign /f "$(ProjectDir)my.pfx" /p mypass /t timstamp.dll "$(TargetPath)"
)
Debug is for testing purposes. I'm trying to mimic Visual Studio command prompt - execute $(VS100COMNTOOLS)VCVarsQueryRegistry.bat which adds some extra variables and then use it later. $(WindowsSdkDir)is what I need.
While that script works perfectly in simple bat file it refuses to work in Visual Studio. Output is:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\VCVarsQueryRegistry.bat"
call "bin/signtool.exe" sign ...
Notice that it doesn't recognize $(WindowsSdkDir), which is created in VCVarsQueryRegistry.bat.
Is it possible to declare var in bat and use it later in post-build or I should use another approach?
It's a bit tricky:
first, for cmd variables you need to use %var% syntax instead of msbuild-like $(var)
next, SET statements from call batches do apply.. but if body precalculates its variables, so you need several if lines instead of just one if body. Here is good explanation of such behavior and other ways to avoid it Weird scope issue in .bat file
So, this one should work:
if $(ConfigurationName) == Debug call "%VS100COMNTOOLS%VCVarsQueryRegistry.bat"
if $(ConfigurationName) == Debug call "%WindowsSdkDir%bin\signtool.exe" sign /f "$(ProjectDir)my.pfx" /p mypass /t timstamp.dll "$(TargetPath)"