How configure team city /agents to build different dot net framework version applications

If we will migrate  applications from dotnet framework 4.5 to dotnet framework 4.8. So, Now if there are few applications on dotnet 4.5 and few on dotnet 4.8 framework.

I'd like to know if there is any way we can have multiple dotnet framework version on a single agent and can specify it as part of the build configuration in team city or not ?

 

or can have multiple agents for same and how can configure ?

Any reference would help to setup it if possible ?

 

Please suggest ?

0
1 comment
Hi,

Yes, it should be possible.
1. You can set the Required SDK setting in the .NET build step. This setting doesn't specify what .NET executable file to use; it allows for the specification of SDKs that must be installed on a build agent so that it can run this build. Then, to make .NET CLI use a specific SDK version, you should use the general to .NET projects approach: create a file named `global.json` (https://learn.microsoft.com/en-us/dotnet/core/tools/global-json) with the following content next to the project/solution file you are building.
```
{ "sdk": { "version": "<SDK_Version>", }}
```
2. If you want your build to use a specific .NET executable during the build (dotnet.exe on Windows, dotnet on Mac/Linux), please take a look at https://www.jetbrains.com/help/teamcity/2024.03/net.html#.NET+Version+Detection+Algorithm. You should be able to create a command line build step where you specify the DOTNET_HOME environment variable before the .NET build steps and point it to the .NET installation you need.
3. Another option is to have your builds run in a Docker container and specify the required container with a required version in a build step: https://www.jetbrains.com/help/teamcity/2024.07/net.html#Docker+Settings.

Please let me know if it answers your question.

Best regards,
Anton
0

Please sign in to leave a comment.