I've recently installed VS 2010 Ultimate, and decided to move a project to TeamCity, The project contains a few *.dlls with unit tests inside.
In VS 2008 the setup procedure, at the build runner stage, would consist of :
Setting the path to the *.sln file
Setting the VS version (2008)
Setting the target(s) such as : "Clean Build"
Setting the configuration such as : "Debug"
Setting the platform sucha as : "any cpu"
Checking the "Enable MSTest tests" checkbox
Setting the path to MSTest.exe (pickable from the list of shortcuts)
Listing the assembly files : (1st one beging the dll called : Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll)
Picking the MSTest *.trx test results file
In VS2010 the forementioned dll file is gone, and I'm unable to setup the MSTests, does anyone have a recipe how to do that?
edit : replaced config file with the *.trx file line
I am currently using MSTest with VS2010 on TeamCity and the tests are working perfectly. These are the only steps I had to do for the MSTest part:
Checking the "Enable MSTest tests" checkbox
Setting the path to MSTest.exe (pickable from the list of shortcuts)
Listing the assembly files
I did not have to select the .trx test results file or add Microsoft.VisualStudio.QualityTools.MSBuildTasks.dll to the list of assemblies, and all of the other fields in the 'MSTest Settings' section are empty.
Related
I've been a linux/make guy and recently I'm learning to build UE5 engine from VS 2022. I need to figure out a CLI way to build it.
For example, I right click on one of the modules (not sure if it's the most proper name) and choose 'Build' then the build will start. I want to automate the procedure using CLI.
How can I find the corresponding CLI command for this manual operation?
I don't have access to the Unreal Engine source code and I don't know if Epic has done anything highly unconventional.
From your start menu launch the "Developer Command Prompt for VS2022". This is a shortcut file for launching the Windows command line with a batch file run to set up the PATH and other environment variables for the Visual Studio development tools.
Visual Studio project files (.csproj for C# and .vcxproj for C++ for example) are MSBuild files. (MSBuild was inspired by Ant, if that helps.)
Solution files (.sln) are a completely different format but MSBuild can build a solution file.
From the screenshot in the question I can see that the solution is UE5 which will be UE5.sln. I can also see that you want to build a C++ project. I'm guessing the project may be named BenchmarkTest (BenchmarkTest.vcxproj)?
MSBuild has a notion of targets. A target always has a name and it groups a set of tasks to be performed. (It's like a makefile rule in some respects but it's not the same.)
Solutions and projects created with Visual Studio support some standard targets. The 'Build', 'Rebuild', and 'Clean' menu items map directly to some of these targets.
Visual Studio solutions and projects support Configurations and Platforms. The standard Configurations are Debug and Release. The screenshot shows a non-standard configuration of Develop. The screenshot also shows a platform of Win64.
In the Developer Command Prompt, msbuild should be in the PATH. Try the following command:
msbuild --version
To build the solution with the default target (which is 'build') and the default configuration and platform:
msbuild UE5.sln
To run a 'clean':
msbuild UE5.sln -target:clean
The target switch can be shortened to -t.
The configuration and platform are passed as properties using the -property switch. The short form is -p. Multiple property switches can be provided and multiple properties, delimited by ';', can be provided in one property switch.
msbuild UE5.sln -t:rebuild -p:Configuration=Develop -p:Platform=Win64
or
msbuild UE5.sln -t:rebuild -p:Configuration=Develop;Platform=Win64
To build the BenchmarkTest project, specify the project file:
msbuild BenchmarkTest.vcxproj -t:build -p:Configuration=Develop;Platform=Win64
I'm trying to build my solution and package up the web app into a web deploy (.zip) package to be deployed.
I've added the Visual Studio Build step with the following MSBuild Arguments:
/p:DeployOnBuild=True /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\"
And I've set up the Copy and Publish Build Artifacts step to copy all .zip files to the drop folder.
The build completes successfully but nothing is copied to the drop folder because there are no .zip packages that get created.
So when I look on the TFS server, the only thing in the 'a' folder is an empty 'drop' folder. And in the 's' folder is the solution directory with a PrecompiledWeb folder in it. Not sure what that is but it doesn't look like the deployment package (and it's not a .zip).
Any ideas?
I have tried the same on VS2015 MVC web application using VSTS and TFS 2015.2.1 both. I had to do a slight change to the Build arguments in Visual Studio build. That is removing the trailing "\" in /p:PackageLocation="$(build.artifactstagingdirectory)\".
Here is the argument I passed to Visual studio build step
/p:DeployOnBuild=True /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)"
Then I used Copy and Published Build Artifacts (Deprecated in VSTS you should use Copy task and Publish task instead of this task) as shown below
This gives me output as below.
First suggest you manually remote in the build agent and build the project through MSBuild command line with arguments to see if the project builds properly.
This will narrow down the issue is related to the environment on your build agent or your build definition.
You should directly use /p:PackageLocation=$(build.stagingDirectory
Besides since you have multiple assemblies that are referenced in the web app. Please also double check dependencies that are building in the correct order or referenced correctly.
Make sure the ASP.NET development workload of Visual Studio is installed.
If DeployOnBuild is having no effect, you may need to install the ASP.NET Development "workload" with the VS setup tool.
There are specific .targets files that, if they don't exist, cause these parameters to be silently ignored. Installing this adds those .targets and the parameters become active, allowing the .zip to be created.
For me (VS 2017) the relevant target file (or one of them, anyway) that was missing but is needed is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets
If it is missing, you'll need to install as above, and if it is there, then you have a different problem. ;)
I have created InstallShield Basic MSI project from Visual Studio (IS 2012 Spring, VS 2010). My InstallShield project having 2 product configurations and each configuration having one release.
Product Configuration 1
Release 1
Product Configuration 2
Release 2
For building project in VS IDE, I need to set the corresponding product configuration as 'Default Product Configuration' and build. This is working fine. The Default configuration release is getting build.
But, how can we achieve this in MSBuild command line?
I need to build both configuration separately using MSBuild command line (without changing Default configuration through IDE).
Could anyone please share the proper way to build IS project in MSBuild command line?
Thanks,
Saravanan
how can we achieve this in MSBuild command line?
You can use Properties in the MSBuild command line:
msbuild test.sln /t:project /p:Configuration="Release" /p:Platform="x86" /p:BuildProjectReferences=false
You can also build multiple projects at once:
msbuild test.sln /t:project;project2 /p:Configuration="Release" /p:Platform="x86" /p:BuildProjectReferences=false
Note:
what is assigned to /t is the project name in the solution, it can be different from the project file name.
One important note: if your project has a '.' in the name, you'll need to replace it with a '_' when specifying it with /t
On the TeamCity server we have installed VS 2012.
I have created a build configuration in TeamCity that builds and deploys the solution.
I have added a MSTest 2012 Configuration as well, but don't know how to tell it what project is the VS 2012 test project so that it can run those tests.
Thanks
You need to specify assembly file (dll) of your tests, not the project file (csproj).
Here's an example: http://shrani.si/f/p/PH/2tO4Zo5s/tmpa4cc.jpg
So let's say your Testing assembly is called Company.Tests.dll and it is located in Company.Tests/bin/Debug/Company.Tests.dll
Basically, in "List assembly files:" you must put the path (You can use wildcards)
For example:
**\bin\**\*.Tests.dll
This will locate all assemblies with .Tests.dll suffix.
Regards
How do I set up VS 2010 and NUnit to deploy dependencies for tests like the built in Visual Studio Testing Tools?
The built in tools allow you mark files or folders to deploy with your tests (through "Test Settings: Deployment"). It groups test output into directories sorted by date.
I would like to get something like that working with NUnit (which is awesome, esp with Resharper);
The closest I have been able to come with NUnit is adding this command as a post build event for my test project, where all the files my tests need are in TestResources directory:
xcopy.exe $(ProjectDir)\TestResources . /E /Y
I couldn't find anything on the interwebs, Resharper, or NUnit documentation... and I got lost in the MSBuild docs.
You can files or folders to be copied in the Property Inspector, and they'll be copied over o the output folder. Set the Build Action to "Content": http://msdn.microsoft.com/en-US/library/0c6xyb66(v=VS.80).aspx