Why does Visual Studio automatically reenable "client application services"? - visual-studio-2010

I have a solution consisting of a number of class library project, and a windows service project. When I open the project settings for the windows service project and (accidentally) click on the "Services" tab, Visual Studio insists on automatically ticking the "Enable client application services" checkbox.
The effect of this is that it will add a reference to System.Web.Extensions, and also insert some parts in the app.config. Disabling the checkbox again will not remove the reference. It will however remove the generated configuration, though it will also remove some unrelated configuration that were there before.
Why does it insist on ticking this checkbox, and can I make it not do it? The HELP documentation for the "Settings" tab does not mention any "auto-select" behaviour.
This is Visual Studio 2010, targeting .Net 3.5.
At least one other person have the same issue, unfortunately without any resolution provided:
http://go4answers.webhost4life.com/Example/visual-studio-2010-keeps-enabling-7689.aspx
That in turn links to a Microsoft Connect issue, but for some reason they don't allow access to older reports it seems: https://connect.microsoft.com/VisualStudio/feedback/details/570166

When there is AppSettings item in app.config, the setting “Enable client application services” will be always automatically checked on when to open the project property page.
Reproduce steps:
Using VSTS 2012
Create an empty console application
Add AppSettings section to app.config
Open the project property page and click the "Services" tab
You will see “Enable client application services” is checked on and app.config is updated.
One workaround from our team member:
just to rename the app.config to the its finally deployed file name, such as ConsoleApplication.exe.config and change its file property - "Copy to OutputDirectory" as "Copy if newer".
It works for our project.

Related

Error publishing an ASP.NET Core 3.1 site to Azure from Visual Studio 2019

I have a preexisting ASP.NET Core 3.0 application which is successfully deployed to an Azure App Service (using the AspNetCoreModuleV2 module). After upgrading the app to (today's release of) ASP.NET Core 3.1, the application builds and runs correctly on my local version of IIS Express. When I attempt to publish to the Azure App Service using (today's release of) Visual Studio 16.4, however, I receive the following error:
Assets file 'C:\Project\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v3.0'. Ensure that restore has run and that you have included 'netcoreapp3.0' in the TargetFrameworks for your project.
Notes
My csproj file's <TargetFramework> is correctly set to netcoreapp3.1.
All <PackageReference>'s to Microsoft.AspNetCore, Microsoft.EntityFrameworkCore, and Microsoft.Extensions have been updated to 3.1.0
I have cleaned my solution, and even nuked my obj folder to ensure there aren't any lingering references.
This error is being generated from the 3.1.100 version of Microsoft.PackageDependencyResolution.targets.
I get that something is still hanging onto the .NET Core 3.0 dependencies. But it's unclear why that's only causing problems during deployment. Is Azure App Service not yet ready for .NET Core 3.1? Or is this an issue with the dependency resolution targets?
The immediate issue—as identified in the original question—has to do with there being two places where <TargetFramework> is set:
The project file (e.g., csproj)
The publishing profile (i.e., pubxml)
The <TargetFramework> must be updated in both locations, and they must match exactly. Otherwise, the publishing won't be able to find its targets in the project.assets.json file, which is built based on the <TargetFramework> in the csjproj file.
Note: You may well expect the pubxml file to defer to the <TargetFramework> set in the csproj file, but that is not the case.
Text Editor
To make this modification via a text editor,
Open the ~/Properties/PublishProfiles folder.
Open the *.pubxml you wish to edit.
Modify the value of <TargetFramework> to netcoreapp3.1:
<TargetFramework>netcoreapp3.1</TargetFramework>
Visual Studio 2019
To make this modification via the Visual Studio 2019 IDE,
Click the gear icon ⚙ on the Web One Click Publish toolbar (it's to the right of the publish icon).
Assuming the Target Framework is not set to netcoreapp3.1, click the edit icon next to it.
Ensure that the Target Framework is set to netcoreapp3.1.
Click Save.
Warning: When using the IDE, you may run into a problem here. When editing the profile you'll likely see the new value from your project file (i.e., netcoreapp3.1) already selected. When you click Save, however, it will revert back to the original value (e.g., netcoreapp3.0 in my case). This is because you didn't actually change the value in the interface, which Visual Studio mistakes for there not being a change to the underlying values. If you temporarily toggle another value (e.g., Configuration), then Visual Studio will recognize that a change has occurred, and both values will be updated in the *.pubxml file.
Acknowledgements
Thank you, again, to #PanagiotisKanavos for pointing me in the right direction (see comments on original thread).
Open Project folder;
Navigate to folder Properties>>PublishProfiles
Open file FolderProfile.pubxml then change version 3.0 to 3.1
netcoreapp3.1
Finally, rebuild your application before publishing
I got this error from a fresh new net5.0 project in VS2019 (ASP.NET Core Web Application template) when using the VS web-publisher. The solution is as follows:
Open file: {project}\Properties\PublishProfiles\{project} - Web Deploy.pubxml
Add the following line inside the <PropertyGroup> element:
<TargetFramework>net5.0</TargetFramework>
The element was missing entirely - great work MS
change
<PackageReferenceInclude="Microsoft.AspNetCore"Version="2.2.0" />
to
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
works for me.

In VS2010 the configuration list in Project Property Pages does not match the one in Configuration manager. How do I fix this?

I have an old Visual Studio 2010 Project with a lot of configurations. In an effort to refactor/make sense of the project I decided to shuffle around and re-name some of those configurations (Using the Edit option in the Configuration Manager). The problem? The list of the configurations available in the Project Property Pages (where one can change compiler or linker options etc.) still displays the old names! This can be very confusing and the lack of consistency is infuriating.
I tried restarting Visual Studio and deleting the .user and .sdf files - those didn't help. I even tried to manually Search&Replace the old names with new ones in .vcxproj and .sln files. The only result of that was being unable to open the project properly (does not build).
Is there anything I have done wrong? Can I do anything to restore some order into this project?
I suspect the behaviour I described is a bug in Visual Studio 2010 but I have eventually found a way to do what I wanted despite it.
In order to fully change the name of a Project/Solution Configuration:
Open Configuration Manager
Select <Edit...> from the "Active solution configuration" drop-down list
Change the name of the configuration you want to edit and close the Edit Solution Configurations window
In the "Project contexts" section of Configuration Manager, open the "Configuration" drop-down list. You will notice that the configuration which name you've just changed still has it's old one there. Select <Edit...> once again and change it to whatever you did in step 3.
Visual Studio will notify you in an error prompt that "The operation could not be completed". This is (partially) wrong.
Close the prompt, the Configuration Manager and finally close the solution (from the File menu) saving any changes to it.
Re-open the solution.
Go into the Configuration Manager and once again inspect the relevant "Configuration" drop down in the "Project contexts" menu. You will notice that although initially the old configuration name is displayed, the drop down figures only the new one. Select it. Otherwise attempting to access Project Properties will now generate another "The operation could not be completed" error.
The configuration should now function under its new name.

Visual Studio Configuraiton manager Deploy column disabled

I am having a problem with the configuration manager in Visual Studio 2013. The Deploy column is disabled no. The only thing I did was a Repair of Visual Studio 2013 and not my WebAPI project not longer has the Deploy option enabled in Configuration Manager. I used to be able to do a file system deploy to the folder on the Web Server that hosted my WebAPI process. I am not sure what is going on. Any assistance would be greatly appreciated.
FYI - The CGSAPI project type is class library but that is what it has always been.
OK so I was just being silly. I have to right mouse button click on the actual WebAPI project and Publish will be available in the dropdown list. :)

Stop Visual Studio 2013 modifying the IISExpress applicationHost.config

I have a website project using Visual Studio 2013, and each time I open it, it keeps adding a new entry for the website project in applicationHost.config. I use IISExpress for my development, however I always create a custom entry to provide some specifics and I have it configured to use port 80, so I would like to not have Visual Studio make any modifications to this file.
I have gone into Tools > Options > Web Projects and unchecked "Use the 64 bit version of IIS Express for web sites and projects", closed the solution, removed the entry from applicationHost.config and re-opened the project in Visual Studio, however it still continues to add an entry to applicationHost.config and name my website project whatever that entry is named.
Is there a way to disconnect Visual Studio entirely from IISExpress? I like using it, but I want to control that service and configuration myself.
Inside the bindings section of the site section, create a new binding in addition to the localhost version like so:
<bindings>
<binding protocol="http" bindingInformation="*:21232:localhost" />
<binding protocol="http" bindingInformation="*:21232:*" />
</bindings>
After having both lines, VS stopped making new site sections.
How to: Specify a Port for the Development Server
I just tried out the method described in the above msdn article to change the port IIS express uses (didn't try 80 though).
right click the website in solution explorer, remove (won't delete files)
edit the applicationHost.config file, change the binding
"add existing web site" in Visual Studio (point to the folder of site you previously removed)
At that point it doesn't seem to create a new entry in applicationHost.config, and uses the new port.
We have the same problem here. Two days googling for a solution without success. The only solution until now is to add the website to the solution using the Local IIS option.
I ran into this trouble when I was switching from one TFS workspace to another while experimenting with VS2013. I'd updated to VS2013 from VS2012 in a new workspace, then when I was done and committed the changes, I got the latest in my original workspace and began to use it there with VS2013. Every time I loaded my web project I got the message about it editing my project file, and every time it did, it screwed up the settings.
Here's how I fixed it, after trying the other answers here. A bad .csproj.user file was the problem. I do not use this file, generally, as I have the "Apply server settings to all users (store in project file)" checkbox in the Web properties checked. But I'd used it in the past. Deleting this file, or updating it so that the settings match those I've set in the project file (i.e. setting the port, whether to use IISExpress, etc.) fixed it. I can now load my project without visual studio making (the wrong) edits to my project file every time I load.
In the project properties, I see a "Web" tab, which contains a "Servers" section that has a dropdown where you can select from the following:
IIS Express
Local IIS
External Host
I believe selecting "Local IIS" is the option you need.
If you don't want to use a local development server, you can attach to an IIS process on a local machine very easily.
There's a way to set the build output location for debug in the properties (right-click project in solution explorer and choose 'properties). If you want to do this easily the first time with no extra setup, just copy your debug build's output to your website folder that you configured in IIS.
Next, ensure you can hit the IIS site. If so, go back to Visual Studio and go to the Debug-> Attach to Process menu item. Choose 'w3wp.exe' out of the list (you may have to check 'view all processes'). You should now be able to hit breakpoints in VS.
However, you should also be able to use IIS Express with a specific port, as #Anssssss said.

Visual Studio does not generate app.config content when "add service reference"

When I add a web service by using "add service reference" in the console app, the app.config does not generate the configuration. How do I generate this app.config with a specific wsdl? Thanks!
When adding the service reference try clicking on the 'Advanced...' button and then uncheck the 'Reuse types in referenced assemblies' checkbox.
I found this out when I had created a simple project to test a third party service which all worked fine. Attempting to add the same reference to the main project resulted in the app.config and reference.vb file not being generated correctly.
I think this may have been because there were already other web references in the application or referenced applications, however unchecking 'Reuse types' resulted in the files being generated correctly.
(Same answer I gave at Visual Studio 2010: adding a service reference to a 2008 generated wsdl )
I have experienced the same issue with Visual Studio 2008. I find I get different results if I'm using the "Add Service Reference..." command, or digging deeper to "Add Service Reference..." | "Advanced..." | "Add Web Reference...".
However, the tried-and-true method--and the solution that worked for me--is still via the command line:
svcutil.exe /language:cs /out:GeneratedProxy.cs /config:app.config http://server/path_to/WebServiceBean?WSDL
That should give you a working app.config. Hope that helps!
In my case, following actions resolved
Commented <services> tag in web.config file in WCF Project (from <services> to </services>
Recompiled WCF project
Hosted it at IIS
At client application delete old reference and add again WCF reference
and it worked :)
You can add a Service Reference as usual (no need for advanced). If the config sections do not appear in app.config, you can click "Configure Service Reference...", and uncheck "Reuse types in referenced assemblies". After that it will correctly generate the sections.
This will not automatically generate your settings, but to create the web.config settings without the command line, you can right click on your app.config after adding the service reference and click the "Edit WCF Configuration" button to add the elements you need for your web service.

Resources