.NET - ClickOnce Install - Company Name and Applic

2020-07-06 06:12发布

问题:

What is the proper way to set the Company Name and Application Name in a ClickOnce application?

I have a set of projects in a solution called RecordNavigator. The GUI project is called RecordNavigator.Gui.

When I publish the application - I want the Start menu to have a folder called Tyndall Software and the application shortcut to be called Record Navigator.

Right now the folder says Organization and the shortcut says RecordNavigator.Gui. The AssemblyInfo.cs file seems to have no effect. Is that normal?

回答1:

If you open your project's properties in Visual Studio and click on the 'Publish' tab, there should be an 'Options...' button under 'Install Mode and Settings'. There you can define the Publisher name ('Tyndall Software'), Product name ('Record Navigator'), and other such options.



回答2:

You need to change the ClickOnce manifest, not the assemblyinfo.cs...

There is an MSBuild task for this: GenerateDeploymentManifest

    <GenerateDeploymentManifest
        AssemblyName="$(ApplicationIdentity)"
        AssemblyVersion="$(PublishVersion)"
        Description="$(ApplicationDescription)"
  EntryPoint="@(ApplicationManifest)"
        DeploymentUrl="$(PublishURL)/$(App).application"
        MapFileExtensions="true"
        OutputManifest="$(App).application"
        Product="$(ApplicationDescription)"
        Publisher="$(Publisher)"
        SupportUrl="$(SupportURL)" >
        <Output ItemName="DeploymentManifest" TaskParameter="OutputManifest" />
    </GenerateDeploymentManifest>

Set your $(Description) to the Application Name you want, $(Publisher) value to the Company Name, and the $(SupportURL) to the URL you want to publish.



回答3:

Just as Andy Mikula said - it's on the Publish section in the application's properties, but in my Visual Studio 2008 it's under the Options button and the Description section, the properties are called Publisher Name and Product Name.

You'll find all the ClickOnce settings in the .csproj file for the application. E.g. the fields you want to update exist as:

<ProductName>...</ProductName>
<PublisherName>...</PublisherName>

Side note, these values are not part of the application's ClickOnce identity - so you can change them for an application and the next time your customers update the name of the application will change - I'm not sure about the start menu folder though.



回答4:

Visual Studio 2008 with the Office 2007 VSTO project template does not have options in ClickOnce propeties to modify product name, etc. We had to modify the build target file manually. Luckily, a Microsoft engineer describes exactly how to do so on MSDN.