I want to set up the following CI configurations for the same .net project:
Build and run unit tests (CCNet Project1).
Build and run acceptance (end-to-end integration) tests (CCNet Project2).
So, I need somehow to configure that Project2 should be executed only in case Project1 succeeds and to use the same revision as for the last successfull Project1 revision.
I managed to configure Remote Project trigger. However, it is not unclear for me how to use the same revision number when getting sources from SVN as for the last successfull Project1. Any ideas?
Since the two CCNET projects are tightly coupled my advice would be to let Project1 get the sources from SVN and keep the build version numbers synchronized.
You need to configure the trigger and the labeller for the dependent project. You use Project Trigger as trigger (I assume that is what you meant by "Remote Project trigger") and Remote Project Labeller as labeller:
<project>
<name>Project2</name>
<sourcecontrol type="nullSourceControl" />
<triggers>
<projectTrigger>
<project>Project1</project>
</projectTrigger>
</triggers>
<labeller type="remoteProjectLabeller">
<project>Project1</project>
</labeller>
<!-- ... -->
</project>
Related
In azure devops build pipeline, I am having the below stages.
Prepare analysis on sonar cloud
dotnet restore
dotnet build
dotnet test
dontnet publish
copy test files .. this for copying (*.trx *.xml) to respective directory.
Run code analysis
Publish quality gate result.
here my pipeline runs successfully with the tests but its not giving code coverage. code coverage showing 0.00%
*.trx file is copying on the required path & I have also tried with the default path of trx file but its giving below message in logs.
ERROR MESSAGE
Post-processing started.
00:23:49.775 Property 'sonar.cs.vstest.reportsPaths' provided, skipping the search for TRX files in default folders.
00:23:49.995 Did not find any binary coverage files in the expected location.
00:23:49.995 Falling back on locating coverage files in the agent temp directory.
00:23:49.995 Searching for coverage files in D:\a\_temp
00:23:49.995 No coverage files found in the agent temp directory.
WARNING: The following projects do not have a valid ProjectGuid and were
not built using a valid solution (.sln) thus will be skipped from
analysis...
D:\a\1\s\Rost.API.Tests\Rost.API.Tests.csproj
I expect the code coverage in the pipeline, currently code coverage showing 0.00%.
May i confirm several questions with you?
Did you add --collect "Code coverage" option to the command line arguments?
Code coverage can be collected by adding --collect "Code coverage"
option to the command line arguments. This is currently only available
on the Windows platform.
If run the test command on local, did the code coverage show correctly?
BTW, SonarQube requires a valid Project GUID but Core projects dont actually use this.It is recommended to add the ProjectGUID in the test project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- SonarQube requires a valid Project GUID but Core projects dont actually use this -->
<ProjectGuid>{9C99E491-F56E-4515-9F0B-D72A5207DB13}</ProjectGuid>
</PropertyGroup>
</Project>
I am having trouble figuring out how to use VSTS to deploy an arbitrary directory from my build to an azure web app.
The arbitrary directory is produced during the build step and contains the webpack bundled javascript for my app. Here are the details:
I have an MVC 5 app and I just started using webpack to bundle the output of my typescript files. webpack creates a set of bundles and writes them to $(project_dir)/Scripts/bundles.
All my typescript source are in various other directories under /Scripts as well (App, Api, Lib etc). But from a VS project point of view, bundles is empty, but added to the project.
Everything works great locally. I can do a debug build and webpack-dev-server serves up the bundles. I can do a release build and webpack happily creates the bundles on disk in /Scripts/bundles. And my code happily consumes the bundles.
I have edited the project file to include:
<Content Include="Scripts\Bundles\**" />
and if I do a publish from within visual studio it all works great. But VSTS doesn't seem to recognize this part of the project
We use VSTS to do our building and releasing to azure. I can't for the life of me figure out how to get VSTS to publish this /Scripts/bundles directory.
In my project properties, I created a pre-build step that runs webpack. I know that the files are in the Scripts/bundles directory at the end of the build because the closest I have come to getting this working is to have the VSTS build a second artifact that is the zip file of that bundles directory and the files are in there.
I could solve my problem if I knew one of the following (I think):
how to get an arbitrary directory to show up in the main artifact like the normal build output - I can then use my standard release definition to push it to azure
how to publish a second artifact in a release definition?
If you can solve #2, the issue is that in building the artifact for /Scripts/bundle, it put the contents of the bundle directory in the root of the zip file, rather than having bundle as the root of the zip file. So when I unzip the file, It will have to first create /Scripts/bundle and then unzip.
I must have been entering the wrong search terms when I was first trying to figure out how to do this. Once I hit on the right search terms I found a bunch of articles that talk about how to get "extra files" into the deployment package for Azure.
Here is a good article. I basically followed it and things just worked. I added these lines to my csproj file:
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
WebpackBundles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
WebpackBundles;
$(CopyAllFilesToSingleFolderForMsdeployDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="WebpackBundles">
<ItemGroup>
<_CustomWebPackFiles Include="Scripts\bundles\*" />
<_CustomWebPackFiles Include="Scripts\bundles\**\*" />
<FilesForPackagingFromProject Include="%(_CustomWebPackFiles.Identity)">
<DestinationRelativePath>Scripts\bundles\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
The PropertyGroup was already there. I just inserted the WebpackBundles; call into those two elements and then defined the WebpackBundles target.
And I ended up removing the
<Content Include="Scripts\Bundles\**" />
line and replaced it with the new Target that the article suggests. I am running webpack as a pre-build step only on the release build. I am using webpack-dev-server for the debug build locally. The only change I had to make to our VSTS build was to add two npm steps:
npm install
npm install webpack -g
this allowed the pre-build step to find the webpack executable and run it.
there was no change to the VSTS release definition because the webpack bundles got put into the deployment zip file in the right location.
I am trying to do a Jenkins-based automated build/deployment of a web application (.NET 4.0). The web application project has several project references, which in turn have binary references third party DLLs.
The problem:
The second-level references (references of project references) are not pulled into the bin folder in the obj\<CONFIGURATION>\Package\PackageTmp\bin folder, used for building deployment packages.
When I build in the visual studio, the second level references are pulled into the regular build output directory.
When building with MSBuild, second level dependencies are not pulled into the regular output directory, nor into the PackageTmp\bin directory.
This is confirmed by MS as a Won't-Fix issue here.
Related questions here, here and here either do not match my problem, or offer solutions that don't work. I've reviewed all answers, not just the accepted ones.
My build command looks like this (using MSBuild 4.0):
MSBuild MySolution.sln /p:Configuration=Integration /p:platform="Any
CPU" /t:Clean,Build /p:DeployOnBuild=true /p:DeployTarget=Package
/p:AutoParameterizationWebConfigConnectionStrings=false
I've tried to manually edit Reference elements in project files, adding <Private>True</Private>, with no success.
I am trying to work around this known issue, so that my second-level dependencies are automatically and correctly pulled into the web publishing temp directory.
My current attempt combines the general approach here (customizing the web publishing pipeline by adding a MyProject.wpp.targets file next to the web project file), combined with some MSBuild code for finding DLLs here. So far this has either produced no results or broken the project file. I am new to custom MSBuild code and find it pretty arcane.
My Question: I am looking for a more complete example that works in my specific case. I think the goal is to intervene in the web publishing pipeline that gathers files for copying to the package temp directory, and adding the second-level dependencies to it.
My custom MyWebProj.wpp.targets looks like this:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<BRPathFiles Include="$(SolutionDir)..\Common\**\*.dll;$(SolutionDir)**\*.dll" />
<ConfigPathFiles Include="$(SolutionDir)..\Common\**\*.config;$(SolutionDir)**\*.config" />
</ItemGroup>
<Target Name="CopySecondLevelDependencies" BeforeTargets="CopyAllFilesToSingleFolderForPackage">
<RemoveDuplicates Inputs="#(BRPathFiles->'%(RootDir)%(Directory)')">
<Output TaskParameter="Filtered" ItemName="BRPaths" />
</RemoveDuplicates>
<RemoveDuplicates Inputs="#(ConfigPathFiles->'%(RootDir)%(Directory)')">
<Output TaskParameter="Filtered" ItemName="ConfigPaths" />
</RemoveDuplicates>
<CreateItem Include="%(BRPaths.Identity);%(ConfigPaths.Identity);">
<Output ItemName="FileList" TaskParameter="Include"/>
</CreateItem>
<CreateItem Value="#(BRSearchPath);$(ConfigSearchPath)">
<Output TaskParameter="Value" PropertyName="SecondLevelFiles" />
</CreateItem>
</Target>
<ItemGroup>
<FilesForPackagingFromProject
Include="%(SecondLevelFiles->'$(OutDir)%(FileName)%(Extension)')">
<DestinationRelativePath>$(_PackageTempDir)\bin\%(FileName)%(Extension) </DestinationRelativePath>
<FromTarget>CopySecondLevelDependencies</FromTarget>
<Category>Run</Category>
</FilesForPackagingFromProject>
</ItemGroup>
</Project>
Assuming you have collected all libraries needed at runtime in a folder outside your solution/project, have you tried just using post-build events to copy all these libraries to your main project target directory (bin) and then include that directory in your deployment package using Sayeds method: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx (also available in this post: How do you include additional files using VS2010 web deployment packages?)?
I have (among others) the following line in my main project's post-build events:
xcopy "$(ProjectDir)..\..\Libraries\*.dll" "$(TargetDir)" /Y /S
In addition to this, I have added the following lines to my .csproj file:
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
PostBuildLibraries;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="PostBuildLibraries">
<ItemGroup>
<_PostBuildLibraries Include="$(TargetDir)**\*" />
<FilesForPackagingFromProject Include="%(_PostBuildLibraries.Identity)">
<DestinationRelativePath>$(OutDir)%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
Be sure to add these lines after the import of the "Microsoft.WebApplication.targets". Check out the links above for more details.
This makes all the desired libraries available after each build (copied to the project's target directory) and each time I create a deployment package (copied to the obj\<CONFIGURATION>\Package\PackageTmp\bin).
Also, since I'm building my main project, not my solution, I'm using the $(ProjectDir) macro instead of the $(SolutionDir).
After upgrading to VS2010 we have a few .dbproj files that are causing issues in our CI builds. They do nothing except just store SQL files anyway, so I'd like to just ignore them. I'm running CruiseControl.NET and building my solution with devenv.com. Is there some way for me to tell the build that I want to ignore these projects, or all .dbproj projects?
One way to do it is to create a new solution configuration in Visual Studio. Go to the Debug menu and then Configuration Manager. Create a new configuration and then exclude your .dbproj projects.
Then use that configuration name in the command line of devenv.com instead of 'Debug' or 'Release'
Since its a just a files container project, you could just exclude it from build in Debug and Release
Use msbuild instead of devenv and it will support the 'excluded from build' feature (i think devenv doesn't)
An (somewhat) alternative would be to switch the project into a class library (which will actually will build nothing...)
An example MSBUILD task would be:
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
<workingDirectory>project_solution_path</workingDirectory>
<projectFile>project_solution_file</projectFile>
<buildArgs>/p:Configuration=Debug /p:VCBuildAdditionalOptions="/useenv" /v:diag /t:rebuild</buildArgs>
<timeout>300</timeout>
</msbuild>
HTH
I am just beginning to set up a Continuous Integration Server using CruiseControl.Net. To keep things simple to begin with, I used the Visual Studio Task to carry out the build, pointing it at the project solution file. However, when the build process occurs, CC.Net successfully gets the latest source version from Subversion, and appears to run the devenv command. The build process then fails, but there is no explanation about why. Here is the output:
BUILD FAILED
Project: MyProject
Date of build: 2009-09-09 16:31:13
Running time: 00:00:49
Integration Request: Dashboard triggered a build (ForceBuild)
Modifications since last build (0)
Tests run: 0, Failures: 0, Not run: 0,
Time: 0 seconds No Tests Run This
project doesn't have any tests
There is nothing else displayed on the page. My XML Logs don't show any build results either.
This is my configuration file:
<!--<ccnetconfig><configurationVersion>1.4</configurationVersion></ccnetconfig>-->
<cruisecontrol>
<project name="MyProject">
<workingDirectory>C:\Users\Builder\Desktop\builder-pc\MyProject</workingDirectory>
<sourcecontrol type="svn">
<trunkUrl>svn://builder-pc/MyProject/trunk</trunkUrl>
<workingDirectory>C:\Users\Builder\Desktop\builder-pc\MyProject</workingDirectory>
<executable>C:\Program Files\Subversion\bin\svn.exe</executable>
<autoGetSource>True</autoGetSource>
<tagOnSuccess>True</tagOnSuccess>
</sourcecontrol>
<tasks>
<devenv>
<solutionfile>C:\Users\Builder\Desktop\builder-pc\MyProject\trunk\MyProject.sln</solutionfile>
<configuration>release</configuration>
<buildtype>Rebuild</buildtype>
<executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe</executable>
<buildTimeoutSeconds>600</buildTimeoutSeconds>
</devenv>
</tasks>
</project>
</cruisecontrol>
I have deliberately removed things like the SVN username and password.
Building the solution using the VS Command Prompt works, albeit with warnings. This is using the same swtiches that CC.Net would be using.
Can anyone help? Is it failing because there are no unit tests to run, or because of the warnings? Or is it best to switch to MSBuild or NAnt instead of using the Visual Studio Task?
If there is no useful information in the build log, try looking at the server log for information about the failure.
I think the reason you aren't seeing any output in the xml log files is because you don't have an appropriate <publishers> section in your <project>.
Try:
<publishers>
<xmllogger />
</publishers>
Try running the build with MSBuild instead of devenv.exe. If the log gets merged into the xml but is not displayed properly in the web dashboard, make sure that appropriate xsl transforms are enabled. Also, as Scrappydog mentioned, add the xmllogger publisher (although it should be added by default if you don't have any publishers defined at all, you can check this in the 'Project Configuration' page on the dashboard.
You should use devnev.com (note the file extension is .com, not .exe) in the same path (i.e. C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE), instead of devnev.exe.
The <executable> block is optional, and from the CruiseControl.NET documentation, it will use the latest version of devnev.com, not devnev.exe.