Visual Studio 2017 can't switch between publish profiles - asp.net

In VS2015 community ed. I had two web deployment publish profiles set up with different server targets, like "development" and "live".
Occasionally I want to publish a single file instead of the entire web project, and I can right click on the file in solution explorer and select "publish", and it uploads it to the server.
I was able to switch between the two target servers using the configuration dropdown in the top bar:
I was able to switch freely between the two servers and upload to either one. Occasionally, if this didn't work, I could also go to the Build --> Publish menu, select the target, close without publishing, and then publish individual files by right-clicking in the Solution Explorer on the file and selecting Publish.
In VS2017 CE, this doesn't work anymore. No matter what I select from the profiles, I can only publish individual files to whatever target was selected in the previous full publish. I have to perform a full publish to the selected server, to get the target to change to that server.
Is there any way in VS2017 CE to publish individual files on the fly, to a specific target server using web deploy?

Look for the Web Publish Activity tab available next to Package Manager Console, Error List, Output, etc. There is a dropdown where you can select a publish profile.

Related

How do I publish a Web Forms Application from VS2017 to IIS from Intranet?

I have developed an ASP.NET Web Forms Application in Visual Studio 2017(CE). It's the project that I've developed for my college, as an objective to run it as an Intranet Application so that it could run on a IIS on a PC and people can access it over the Intranet. I've tried using the Web Deploy method, generated a Folder and addressed the IIS to the Published files of Visual Studio. But I don't get it to work, and I feel it's not the right way.
I've tried some research but haven't been able to figure out the right context. Can anyone please recommend me the right place of instructions? Or instruct here itself?
Go to Solution Explorer and select the project then right-click the project
Click the Publish menu item then left panel to publish screen will be open like below screen
Select the publish option as IIS, FTP, etc then click to publish button
The publish window will be open then select publish method as File System and type the Target location as http://localhost/Appname and click Next button.
Now, you can see the setting and file publishing options whatever you want to configure the options and click the Save button
Now you can find the application was published URL http://localhost/App in the output window

Debugging a solution with multiple projects

I am trying to debug a project I inherited. This basically consists of an ASP.NET website hosted in IIS (local IIS not express though), and a number of other projects for example a project containing the model, another project containing the Data Access, another project containing control classes etc.
I have added the ASP.NET IIS hosted website to my Visual Studio solution by Right Clicking Solution > Add > Add Existing Website ...
When I debug the website (by setting it as the startup project) from Visual Studio, it launches and works OK so for example I manage to connect to the Web Services hosted on another server, login etc etc.
However I am finding problems to hit the breakpoints on the other projects, such as XXX.Web.Model, which contains source code I need to debug.
What settings can I modify to hit the breakpoints? I tried attaching w3wp.exe but to no avail.
You might need to set multiple startup projects, and for each of the projects you want to debug set it to 'Start with debugging'. To do that on the solution node in Solution Explorer right click and choose Properties then in the dialog go to the Startup Project tab. As shown in the image below.
Docs are over at https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2017 .

Deployment of web application in VS 2012 to my server

I have Web Application which I would like to deploy to my web server. I do not want to use Windows Azure, I have my own server. I even do not have my profile to publish to Azure. I believe it is OK to not have the profile and continue using VS2012. I would like have complied binary files and all my pages (master, aspx) together with my controls (ascx), js, css files and without code-behind files placed in my local folder. Then I plan to pack them and copy to my server through FTP. Sounds trivial. But...
When I hit right click over my Web Application project and then "Publish...", I have Publish Web window. The first step asks me if I want to publish to Windows Azure. In this case I have to provide my profile which I do not have. I do not need it. I just want to deploy to my local folder all except code-behind files. I cannot choose the next step which is "Connection". So I hit "Publish" button. And now, now I am stuck, because I have to provide my profile (see attached screenshot). Could you tell me how I can prepare my web application for deployment to my web server? Thank you.
If you are not planning on using Azure, simply ignore the statement at the top of that screen, it is only helpful if you are publishing to Azure.
To get past this step, click on the drop down and then click "New profile".
After that you will be taken through the rest of the wizard were you can setup your connection details etc.

asp.net how to hide code in dll files

Is there any way to protect the code written in the cs files? Also for the database?
We designed a website and we're considering publishing it and we have to deliver the project as a college project, but we want to protect the code so we can secure it in case we publish it.
We are already considering publishing the site and then giving them its url but it's our last option.
What can we do in this case besides publishing the site?
Thanks :)
To compile your project into a single dll file, you have to use the Publish Web Site function of Visual Studio. I use Visual Studio Express 2012 (version 11), so if you don't have this version, then there could be slight differences.
Click on the "BUILD" menu, then select Publish Web Site
Create a new Profile if you haven't done so.
Click on 'Connection' on the left side menu of the window, and choose File System to save it on a folder on your computer
Click 'Settings'. Open up File Publish Options and select the following:
Click on the 'Configure' link of the second option in the above screenshot. This will open the following window. Here you can play around with the merge settings. I've tried the 3rd and last option on a test website, and the output was similar. The text (testwebsite) in the textbox is for the name of the DLL file.
Click 'Publish'

Publish profiles don't publish the desired build configuration (.pubxml.user)

Consider the following scenario:
Alice creates Web application (ASP.NET MVC or WebForms) using Visual Studio 2012.
Alice creates a Publish Profile called "PRODUCTION" and chooses "Release" configuration in the Settings tab (in the Publish Wizard).
Alice publishes the application using the Publish Profile called "PRODUCTION".
Alice saves the solution into source control.
Note that by default the "*.pubxml.user" file is not included in source control: http://msdn.microsoft.com/en-us/library/ff398069.aspx
Bob does a Checkout of the solution from the source control.
Bob opens the solution and launches the Publish Wizard.
Bob sees the selected Publish Profile is called "PRODUCTION".
Bob clicks on Settings tab (in the Publish Wizard) and sees the displayed configuration is "Release".
Bob publishes the application.
Bob realizes the application was published using "Debug" configuration instead of "Release" configuration.
The reason is the information about the build configuration is stored in the file "*.pubxml.user" (See node called <LastUsedBuildConfiguration>).
This behavior is problematic especially when you use Web config transformations ("Web.Release.config") to change connection strings.
=> How can I fix this problem if I don't want to save "*.pubxml.user" file into source control (because this file can contains other information inappropriate for a public repository for example)?
Related articles:
http://connect.microsoft.com/VisualStudio/feedback/details/776066/publish-settings-windows-azure-publish-target-profiles-not-selecting-proper-build-configuration
http://sedodream.com/2012/10/27/MSBuildHowToSetTheConfigurationProperty.aspx
http://msdn.microsoft.com/en-us/library/dd465337.aspx
There are two aspects to this; sharing the value in the drop down for the Publish dialog and support for command line. Below are my comments on both.
Sharing profiles with team members
When we released the publish bits in VS2012 RTM we were writing LastUseBuildConfiguraiton into the .pubxml.user file. We have since moved that to the .pubxml file itself so that it is shared with other team members. You can get the latest build at:
ASP.NET 2012.2
Latest Azure SDK
If you have installed one of those and you are still seeing the behavior where the Config is not shared that is likely because the .pubxml was created with an older drop. The solution is to delete the .pubxml and .pubxml.user file and create it again with the latest.
Command line scenarios
For command line scenarios the Configuration property needs to be set explicitly. The .pubxml (or .pubxml.user) file cannot override that value. For more details see my blog at http://sedodream.com/2012/10/27/MSBuildHowToSetTheConfigurationProperty.aspx.
If you have a backup of this Project then no need to worry about this error. Just run the backup project in VS 2012 OR 2013 and open the node of Property and then publish Profile folder and the then you will see there a single file with name of "Your project name.xml" now go to solution explorer menu press the button of "show all files" and you can see an other file with the name of "pubxml.user". Now right click on the publish Profile and click the option "open folder in file explorer" now copy the file and replace it with crashed file.
Now rebuild project and after that publish it.
I was getting this problem today with this project Hajj and Umrah Project now you can see that is live.

Resources