I'm trying to create a pre build event similar to one described in this post
Build another project by prebuild event without adding reference
This is the command line I'm using in the Pre-build command line of the build events tab in Visual Studio 2015.
"$(DevEnvDir)devenv.exe"
$(SolutionDir)MyFolder\SubFolder\MyProject.csproj /Rebuild "Debug|Any
CPU"
However when I hit Build on the project that contains the pre-build event, it begins launching multiple instances of Visual Studio. I am watching the output directory for bin/Debug and it is conintually cleaning and rebulding the project, each time a new instance of Visual Studio is launched. None of the instances close. They remain running.
EDIT: I noticed even after cancelling the build in the IDE and exiting the IDE, the processes are still running and the debug folder is still being cleaned and updated with new dll's each time.
This is what my task manager looks like during the process
Related
I have a two projects in my visual studio solution. One of them generates source code files for the other, and I want to set up the build events so that this is done automatically when building the child project.
I have a pre-build event command in the child project which executes the parent project. This works as intended, and correctly generates the source code in the child. At this point, the source code is complete and can compile without errors.
However, when I try to build the child project visual studio stops with an error, saying that it cannot find the generated source code files. When pre-build completes though, the files exist and the code compiles without errors.
How do I ensure that pre-build has completed before visual studio checks for errors and compiles?
I’m using VS 2019 if it matters.
I want to add post build event to sign some project outputs by my signer app - this is the simple console application with the one action inside.
I had added this in the Post-build event command line window
$(OutDir)\Tools\SignTool.exe $(TargetPath)
On this command Visual Studio (2015) create a temporary exe for some reason in temporary folder and try to run it. My company's security settings block it and I think they right but build has failed.
Can somebody help to explain how to prevent VS to do this odd action and just run the *.exe or how to change the temp folder for VS without changing the global environment temp?
Not sure, if you still need an answer on this. We had the same issue here in our company (with VS 2019). Every Pre- or Postbuild event in your project will be automatically packed into one Batch-file (*.cmd). VS creates this batch file in the global temp path. As far as I know, you can't change this temp folder only for Visual Studio.
What we have done was creating a group policy for developers to enable batch creation by Visual Studio 2019 in temp folder. Now we are able to sign our EXE with Postbuild event (as you mentioned), and we can debug / run our applications with Visual Studio, finally.
In my solution I have a project with an attached pre-build event to check if certain files need to be regenerated. This all works fine if something changed in the project (or dependent projects). However, if nothing changed the pre-build event is not triggered.
Is there a way to run the pre-build event everytime VS tries to build a project (even if it is clean from a code file standpoint)?
Alternatively, is there any other way to run a script first before building a project so that I can regenerate my files first?
For a Visual C++ project you may specify Command Line in the Custom build step (Configuration Properties - Custom build step) and leave the field Outputs empty. It will be executed even if the project has no changes.
Here is the similar question.
I have a pre-build event on a C# project -- when built from VS2010, this pre-build event runs on every build of the project. From VS2012, however, the pre-build event only runs when the project needs rebuilt, not on every build.
Is there a way to circumvent this behavior in VS2012 and forece the pre-build event to run on every build?
in my project I have defined a post-build step, where the linked executable is moved to another directory. Now I wrote an addin for the Visual Studio, which handles the build events and do some actions on the linked executable after the build. My problem is, the post-build step of the Visual Studio is executed before the post-build event (OnBuildDone) is raised, so the executable is already moved from the build directory. How can I ensure, that my addin is executed before the post-build step of the VS?
You can find the answer here:
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/58d8c785-e0c1-42e9-8092-726964f12044/
The short version:
"The Post Build event is actually a part of MsBuild. That’s why the OnBuildDone is fired after the PostBuildEvent."