Date of last publication

Asked

Viewed 128 times

0

We are having problems with publishing. We use TFS to convert the application. However, there are two people doing the final publication (I don’t accept this). There’s how I go to Visual Studio and see the date of my last publication on my machine?

  • 1

    Right click on the solution -> Source Control -> View History ??

  • @Cesarmiguel, But History does not show the date of the last Publish. It shows the history of TFS, but Publish it does not show.

  • and if you actually go to the TFS website?

  • If the publications are made only from a Publish in the visual studio, I believe there is no way to know. If so, I suggest removing write permission from the respective(s) resource(s) that is(m) posting improperly to the respective(s) server(s). Now if you’re using Team Build to do.

  • @Conradclark, I don’t publish directly into a folder and then move up to the right environments. I don’t use team build.

  • It is possible to withdraw these people’s permission for this pasta? If you really need to know when was the last time you published from your machine, I think you can include an extra step after Publish to record the current date in a file or some sort of log. If you want details on how to do that, I can answer the question.

  • @Conradclark, you can answer the question. I need to do this

Show 2 more comments

1 answer

1

Okay, a simple way to create a log to record the date every time a Publish run is by changing the build process to generate a log file after Publish. Note that this file is being generated from your machine, so it is only valid for publishes that you carry out.

First of all, create a . targets file in the solution, in the project, where you prefer and with the name you prefer:

inserir a descrição da imagem aqui

The file must contain the following code or similar:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CustomPublish" AfterTargets="AfterPublish" >
    <ItemGroup>
        <LogFile Include="$(SolutionDir)log.txt"/>
        <DateTimeNow Include="data1">
            <Text>
                $([System.DateTime]::Now)
            </Text>
        </DateTimeNow>
    </ItemGroup>

    <WriteLinesToFile
        File="@(LogFile)"
        Lines="@(DateTimeNow->'%(Text)')"
        Overwrite="true"
        Encoding="Unicode"/>
</Target>

I think reading can understand what he does, is a Target that always runs after the AfterPublish, executing the specified code. I am setting the current time/date (which will be the time/date of the publication) to a variable and writing to a file called log.txt, which will be in the root folder of the solution.

After saving this file, click "Unload Project" in your project, edit the file (Command Edit xxx.csproj), and add the following line at the end, still inside the tag Project:

<Import Project="$(SolutionDir)postPublish.targets" />

This path will change depending on where you put the targets file you created. After you do a Publish, the command will be executed and will generate a log file with the date.

One important detail: If it’s not a console/windows app/genre thing, maybe the name on AfterTargets change. Searching the internet or even searching in the msbuild logs you can easily know the name you will need to use.

Browser other questions tagged

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