Change csproj value through Teamcity

Asked

Viewed 50 times

3

Hello, everybody.

I am using Teamcity for .NET. I have set up some projects, and the build-Steps basically consist of building the application with the Visual Studio (.sln) Runner and run unit tests with Nunit, and this is all triggered through the Build Triggers that searches for the changes sent to Github.

I was hoping that during this build process, the property value MvcBuildViews was changed to true, to include the screens in the compilation.

<MvcBuildViews>false</MvcBuildViews>

I found some useful articles, but they had as a prerequisite the use of Msbuild. It is possible to do it somehow simpler?

1 answer

2


An alternative is to create a Pre-buildevent that triggers a program that will open the file "csproj" and then replace the desired line.

This application (can be done in C# itself, Console Application) can receive in one of the parameters the name of the configuration being built (i.e. Debug or Release) so that the replacement is made only in Release.

Example of Pre-buildevent:

ReplaceConsoleApp.exe "$(ConfigurationName)" "$(SolutionPath)"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.