Publish Configuration disabled for csproj
Asked Answered
P

1

6

Why can't I change these settings shown in the image below? CSProj Properties windows showing disabled configuration profile

This is a clickOnce application, and my problem is that I want to change by publish path, assembly name, product name, install URL, and preform some app.config translations based on the build configuration. I am able to achieve this by manually editing the csproj like so

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <AssemblyName>someApplicationTest</AssemblyName>
    <ProductName>Some Application Test</ProductName>
    <PublishUrl>c:\publish\someApplicationTest\</PublishUrl>
    <InstallUrl>http://sub.example.com/someApplicationTest/</InstallUrl>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <AssemblyName>someApplication</AssemblyName>
    <ProductName>Some Application</ProductName>
    <PublishUrl>c:\publish\someApplication\</PublishUrl>
    <InstallUrl>http://sub.example.com/someApplication/</InstallUrl>
</PropertyGroup>

I'm just confused why these options are disabled in visual studio and if I'm missing something. Perhaps I'm confused and these controls weren't even intended for this purpose.

Also, I'm going to be investigating Squirrel.Windows as an alternative later, but for now I wanted to learn more about this.

Pompon answered 11/11, 2015 at 21:41 Comment(4)
Have you tried creating a new project and importing all your forms/code?Hypervitaminosis
No i have not, curious as to what you're looking for with that approach though.Pompon
To know if you have a config that influence the disabled fieldsHypervitaminosis
Creating a new WPF project in Visual Studio 2015 Enterprise still has the same issue. Same with a Web Application (ASP.NET 4.6.1), I didn't import any existing code.Pompon
L
2

This is just a visual representation of the structure of a project file. Some settings can have different values for different configurations. Others have only one value that doesn't depend on the configuration. The best example of the first set are the settings in the Build tab. Of course you want to build your program differently in the Release build. So the configuration combos are enabled.

Also have a look-see in the .csproj file with a text editor, Notepad will do just fine. Note the <PropertyGroup> elements, some have a Condition attribute that enables them for a specific configuration. The publish properties are located in the PropertyGroup without a Condition.

So for the settings in the Publish tab Microsoft decided that it was not necessary to make the settings specific to a configuration. Which makes sense if you think about it, you'd only publish your Release build. Well, normally. So the combos are disabled. Feature, not a bug.

Latrice answered 11/11, 2015 at 21:41 Comment(5)
I understand how, under normal circumstances, it would make sense to only publish the release build. But what about when you use the publish profiles to build for different stages (e.g. Development, Staging, etc). And you publish using clickOnce.Pompon
You ask "why these options are disabled", I explained it. That your workflow is not one that was predicted by Microsoft ought to be a bit obvious. Nobody does this, it isn't what CO was meant to do. Google ".net alm tooling" to get ahead.Latrice
Okay, I was just curious why I would be taunted with the controls as if someone, at some point, had thought that this was a valid use, but then decided against it, although didn't really follow up with it, just left the controls disabled... suppose we will never really know...Pompon
I stated "[If] these controls weren't even intended for this purpose" in the original question.Pompon
Completely disagree, with full dev, staging, and production environments, it's very reasonable to want to publish the application to multiple places for comprehensive testing. Nonetheless, thanks for the answer.Apothem

© 2022 - 2024 — McMap. All rights reserved.