1

I want to read fields from a .pubxml file during runtime. I'm working on a code base that uses a .pubxml file called "Production Publish Profile.pubxml". I'm unfamiliar with how publishing .NET programs is handled, and the lead developer has recently updated this process.

This file is located under the Project -> Properties -> PublishProfiles directory, and is structured roughly like so:

<?xml version="1.0" encoding="utf-8"?>

<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ApplicationRevision>6</ApplicationRevision>
    <ApplicationVersion>7.1.0.*</ApplicationVersion>
    ...
  </PropertyGroup>
</Project>

What I'm looking to do is extract the Application Revision and Version fields during run time, so that I can insert those into necessary error logs. How can I access these fields freely, or at least read them when compiling the program?

  • 2
    That file is *not* used during runtime. It's only used by Visual Studio to deploy applications but is never deployed itself, just like eg `csproj` – Panagiotis Kanavos Dec 23 '21 at 16:26
  • 2
    The `pubxml` file is the publishing profile. It's not deployed itself. Its information is used to generate the information stored in assembly attributes and the application's manifest – Panagiotis Kanavos Dec 23 '21 at 16:31

0 Answers0