Is it possible to have a workspace mapping that includes paths from two projects in Builds in DevOps?
I have created this mapping in a build in ProjectOne that includes a path from ProjectTwo, but when running the build it will only map the files from ProjectOne:
Yes, it's supported.
Just try to specify the Local path under $(build.sourcesDirectory).
Tested on my side, everything works as expected.
Related
I'm using TeamCity Professional 2020.1.2 .
under a project I have multiple build configurations.
what I want to do is generate a random string in every build of build config "A"
and override it every time, build config "A" runs.
Then I need to use it somewhere in build config "B"
I know how to pass variables between build steps, but I don't know how to do the same between different build configurations.
echo "##teamcity[setParameter name='env.path' value='/sample/path']"
I thought meybe there should be a global parameter registry which every build can read and write from.
Have you tried to use a snapshot dependency between build configurations?
In this case, you can access a parameter from another configuration in the chain by %dep.BUILD_ID.param%.
Here are two related pages in the documentation: "Build dependencies" and "Dependencies properties".
I have a solution that has 6 projects, some of which are in separate DevOps projects. I am attempting to setup a build pipeline in Azure DevOps and my repository is already located there. Regardless of location, I continue to get errors that the csproj file cannot be found for any of the projects. The build cannot continue without the csproj files (obviously).
I have tried to move the .SLN file to the root folder, inside the specific project file and still get this error. I have also looked at the relative paths in the .SLN and attempted to manually modify them without any change.
Additionally, I used the vanilla configuration for the build pipeline before attempting to change path locations etc.
Here is the structure of source control:
Source structure
The 6 projects highlighted yellow are included in this solution.
Here is the output errors from the build in DevOps:
Output errors
I also tried adding the locations explicitly without any luck. By default, the location path was just $/PermitInspector/PermitInspector which is the location of the .SLN file. (Which is where I started with the attempt to automate builds).
Any suggestions would be helpful and I would be happy to share additional information or screen grabs that might be useful, but this is all I can come up with so far.
I was able to resolve the path issues by applying path filters under the build configuration in DevOps. There is a single work space and 3 of the projects are located in a root folder within the work space and the other 3 projects were in a separate root folder. The main issue appeared to be that the solution file is located inside the second root folder so I had to explicitly define the path to the other project files. By default, the only mapped work space was to the location of the SLN file. Now if I can just get NuGet restore working for the sub-projects! Thanks again,
Correct mapping that fixed the issue
I have a C++ project for which I need to run a custom build tool on some header files to generate code that is required when compiling this project. In general my configuration works. I trigger a build, VS/MSBuild detects whether the output files are up-to-date and runs the custom build tool only if necessary.
However, a problem arises if the build is run in combination with another configuration of the same project. Both configurations depend on the output files of the custom build tool. So if run sequentially only one configuration should trigger the custom build tool to run. For which ever configuration a build is triggered second the output files of the custom build tool are already present and up-to-date. So there is no need to build them again. Unfortunately this is exactly what is happening. Since the custom build tool takes quite some time to run, this increases build times dramatically.
Another interesting aspect is, that once both configuration have run, I can trigger any of them again and the custom build tool is not invoked.
What I would have expected from the documentation is that the custom build tool is triggered:
If any of the files specified as Outputs is missing
If the file for which I specified the custom build tool was modified later than any of the existing files specified as Outputs
If any of the files I specified as Additional Dependencies were modified later than any of the existing files specified as Outputs
But all of this independent from the configuration for which the build was triggered.
Does anyone have an idea on why this might happen? I checked that the settings for the custom build tool are identical for both configurations. The output files are generated into the same folder for both configurations.
The documentation you're referring to is basically correct but it omits to say that everything in there is basically per project configuration/platform because it uses tracker.exe which depends on .tlog files which by default go into the intermediate directory. So as you figured out, making all configurations use the same location for the tlog files should keep the tracker happy and only invoke the custom build tool when needed, independent of configuration/platform. I'm not sure I'd recommend any of this though, sharing temporary object files might cause you problems later.
Another way to deal with this is adding a seperate project with just one configuration, say 'Custom', and do the custom build there. Than make your current project(s) depend on that project and in the solution's Configuration Manager adjust all entries so each configuration you have now builds the 'Custom' configuration for the new project.
I'd like to setup a TeamCity build that will perform an incremental build.
For this, i want to store the build outputs (.dll files) as artifacts, and reuse them on every subsequent build (copy the latest artifacts to the build agent before starting the build).
This will effectively place the last build's artifacts in the project's output folder, so MSBuild could use those artifacts to determine whether it needs to rebuild anything from sources.
I've tried to do this, but it seems TeamCity doesn't allow configuring artifact dependencies from the same build configuration.
For example, if i have a "Build Plugins" configuration that generates a collection of plugin DLLs, i cannot use these as a dependency for the same build configuration...
Is there any inherent way to overcome this in TeamCity, or to create an easy solution myself?
It appears it is only possible to do this when using templates.
You can create a template for a build. Then you create a build from that template. After that you add this build to the artefact dependencies from the template. This allows for circular dependencies.
I have found no other way.
It looks like you can do this now! It seems to work in 9.0.1, and TW-12984 says it should work as far back as 8.1.
I am using VC++ with multiple projects that require a 3rd party library. As developers may have this library in different paths, each developer sets the local machine/user's Microsoft.Cpp.Win32.user property sheet with the appropriate paths.
Now we using a new version of the 3rd party library with some of the projects. As before, different developers may have the new library in different paths. How do we set local machine and project specific paths so that we can compile both old and new library projects?
Modifying a project's 'VC++ Directories' changes the project file (.vcxproj) which then poses a problem as we do not want to commit local settings into the repo.
We normally set an environment variable for each library that can be set by each developer in their environment in a env.bat file they run before running devenv (some made up examples) :-
ZLIB_ROOT=c:\somewhere\thirdparty\zlib
BOOST_ROOT=c:\somewhere\thirdparty\boost\version_123
and then in the project files add directories use "$(ZLIB_ROOT)/Include" or "$(ZLIB_ROOT)/Lib/x86" (all made up examples again...)
That way they will resolve correctly for any developer and they can have a different env.bat script for each version