Versions of CommonAssemblyInfo.cs and MSBuild

So, I have CommonAssemblyInfo.cs connected with all the projects in my solution and dynamically generated by my rake / albacore scripts that are not checked for initial control.

I also have CommonAssemblyInfo.cs.local for use when a ruby โ€‹โ€‹is unavailable, mainly for use by developers.

Is it possible to have a msbuild task or something that runs before any other compilation of a project that copies CommonAssemblyInfo.cs.local to CommonAssemblyInfo.cs before trying to compile my solution? I don't like having a team that you just need to know and type in to open and build a solution in Visual Studio.

UPDATE Thus, I ended up using the batch file as a large-scale pre-build event, as described here: Solution pre-build event? , it checks to see if there is a CommonAssemblyInfo. cs exists and if it does not copy CommonAssemblyInfo.cs.local to CommonAssemblyInfo.cs, simply using a simple batch file.

+3
source share
2 answers

This is the solution I ended up with.

I have every project in the solution link of CommonAssemblyInfo.cs, which is automatically generated for me by my build scripts (rake + albacore).

CommonAssemblyInfo.cs , CommonAssemblyInfo.cs.local.

: go.bat, CommonAssemblyInfo.cs.local CommonAssemblyInfo.cs, , VS.

, , , "" . :

PreBuild, . , . , :

echo verifying CommonVersionInfo.cs exists
cd
IF NOT EXIST ..\..\..\CommonAssemblyInfo.cs COPY ..\..\..\CommonAssemblyInfo.cs.local ..\..\..\CommonAssemblyInfo.cs

, , , VS, , .

+3

VS IDE ? , "AfterGet" "" msbuild. VS IDE, "copy" msbuild.

0

Source: https://habr.com/ru/post/1747581/


All Articles