How to prevent launchSettings.json from being created in Visual Studio 2017 - visual-studio

VS 2017 creates a file for ASP.NET Core MVC projects, called launchSettings.json, which contains information about IIS Express and Kestrel AMAIK.
We host our projects in IIS even on development machines, thus we don't really need these files.
We delete them, yet they keep coming back and each time we open up a solution, they show up.
Is there a way to prevent VS from creating those files?

As per https://developercommunity.visualstudio.com/comments/652195/view.html - just add the following property to the .csproj:
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>

Related

Visual Studio 2015 ftp publish method doesn't always update changed files on publish

We have been using the ftp publishing method to upload our site to an external server. But have recently discovered that some of the JavaScript files that have been changed are not being updated when published. We have checked on the server to verify if the files have been uploaded and only found the old versions, so it's not a cache issue.
Additional Information:
We are using Visual Studio Team Services
We are using ASP.NET MVC.
We have the 'Exclude files from the App_Data folder' File Publish
Option checked.
We are not sure what is causing this to happen but suspect that the issue might be caused by source control. That the files that have been worked on and checked in on one machine are not seen as having been changed by the Visual Studio on the machine doing the publication.
We've found this question Content files not updating with Visual Studio 2010 FTP Publish that seems to relate to the issue we're having but would prefer not to have to use the workarounds provided.
Is there a other way to fix or avoid this issue?
I've been experiencing this off-and-on with file system publishing. Out of pure desperation I created a new publish profile and...it worked.
It appears to be related an issue with the .user file that's created for the publish profile. While not a solution, a workaround at least can be to remove the .user file if a problem is encountered.
Related question: Visual Studio 2012 Web Publish doesn't copy files

WCF IIS configuration and Visual Studio 2010 debug configuration

I am trying to set up my WCF service (.svc) to work in Visual Studio 2010 (pressing F5 to debug), but also to have multiple configurations for each environments (DEV, QA, UAT & Prod). When I originally built the WCF it was used purely in Visual Studio 2010 using .Net version 4 and debugging the service was easy enough by adding a WinForm application to pass in the values needed. When it was time to test the service on a server, I used the Publish feature to put the files on the DEV server and noticed that since it was using IIS that a web.config was created in the base directory.
So now that we are moving on to QA and UAT I need to make sure we have the configuration files for each environment as the Uri's change as well as various other values. Now after searching for a few days on Google, I have tried to use the XDT Transformations, but without having a third party add-in like SlowCheetah, this does not seem to work as it is only built for Web Applications. I have also tried to set up a post-build event to copy different configs:
copy "$(ProjectDir)Config\web.$(ConfigurationName).config" "$(ProjectDir)web.config" /Y
The copy process is set in the Build Events --> Post-build event command line textbox, however this does not seem to work when I use the publish method. I am ok with using multiple config files and copying them, I just have not had success with this.
The XDT makes the most sense to me and would be my preference if I could get it working. The main issue I am having is that it needs to work in Visual Studio, but also to work via IIS on the servers without having to go through a bunch of steps per environment. This is a company rule that I have to follow as well as not having a third party plug-in/add-in.
Is it possible to run the service in IIS and create a servicehost via code? I don't think it is as I believe the MSDN docs say that IIS creates it for you no matter what. Part of my reason wanting to do different configs is so that the page the user gets when they view the .svc file in the browser has the correct Uri in it not the machine name version.
TIA
EDIT: Setting up a dev web.config and including it in the project and then setting it to Build Action: Content fixes the copy method, so technically I have it working as long as I have completely different web.config files for each environment and an app.config for debugging (F5 in Visual Studio).

Opening a Visual Studio 2010 project in 2012 what creates the backup folder and how to control it?

I have an issue. We are upgrading to VS 2012 at work. When we open a VS 2010 project Visual Studio converts the project. This is fine, because VS 2010 can still use the project (yay microsoft). However, there is a \Backup folder created in the solution directory. Is this being created as part of the migration? Is there any way to control it?
The reason I ask is that the process that makes this folder copies web.config files into the folder. If you then try to build the solution (these are MVC projects), we get a "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." error. The cause is that there is a web.config file in a subfolder instead of the root folder. We did not make and do not want this change, and cannot figure out how to control it. Deleting the Backup\Web.config file fixes the error. Renaming it from web.config to web.config.bak fixes the problem.
I don't really want to have to personally open and convert every single project, and don't want random people bumping into this problem. Any idea how to either stop VS from creating the Backup folder, or how to make it create them in the my documents studio folder etc? I can't find any setting to control this and can't find any good info.
By chance, are you using the MvcBuildViews property to pre-compile your views at build time? If so, this is why you're encountering this (since it does the pre-compile in the same directory, it doesn't filter out any of the files below the project directory).
Note that you will also encounter this issue if you use the Publish feature for this project. Publish copies the web.config under your intermediate build output directory (by default, obj/) before and after applying web.config transforms.
The good news is that in VS2012, or in VS2010 with the latest Azure SDK installed, pre-compile is now supported for Web Application Projects (including MVC). These settings are currently in the project properties, under the Package/Publish Web tab.
(this doesn't directly address your question about the Backup folder, but it was too long for a comment.)
There is no way to control it that I found. We had to go ahead and run through and convert every project to 2012 and delete the backup folders to prevent any other team from running into it.

Using IIS Express with a team - when not using localhost

I assume we must be missing a trick as we are finding using IIS Express with teams quite painful.
The issue is IIS Express' applicationhost.config is stored locally in each persons MyDocuments folder, and thus separate to the Visual Studio solution and not in source control.
So when we make a change everyone has to manually update applicationhost.config on their machine.
THe update visual studio does to the applicationhost.config file fails, because we are not using localhost, we have host entries to give our environments different names.
Is there a better way?
Refer to Here
UPDATE FOR VISUAL STUDIO 2015: As was pointed out to me in a comment
by Søren Nielsen, in Visual Studio 2015 the IIS Express configuration
files have moved. They are now separate per project, and stored in
/{project folder}/.vs/config/applicationhost.config. Which is much
better, in my opinion, just don't forget to add .vs/ to your
.gitignore/.hgignore files!
Other wise NO there is no better way. Instead of IIS Express, for remote access you can use IIS on your development machine...
It doesn't seem a big deal: when you load a project configured to run with IIS express, VS checks your applicationhost.config for that entry. If it doesn't find it, it just prompts you with the problem and asks you if you want it to create it for you. Just click "yes" and the entry is added.
At least, that's how we deal with that here. The problem is just the first time anyway, all other settings are stored in web.config in the project, which is versioned, so everything should be smooth.

Visual Studio 2005: File->New->Project vs File->New->Web Site?

Say I want to create vb.net application in Visual studio 2005.
What is the difference between File->New->Project vs File->New->Web Site?
EDIT
I am aware that when using New->Project there are many more options available but if one wants to create just .net web application, would it make a any difference what option you choose?
Here's a good link about WAPs (web application projects) and the differences between WAPs and website projects.
In 2003, your only option (if I recall correctly) was the WAP. 2005 introduced the concept of website projects, where all your code is uploaded to the server and compiled into DLLs on first access. This allows you to easily change your code without having to compile and publish the dlls.
Not a lot of people liked this new way of doing it, so MS created an update to allow for 2003 style WAPs in 2005. 2008 retains both options.
The File->New->Web site option is the only way to create a website application (or, at least it is in 2k8). The only way to create a WAP is to do File->New Project->Web->...
If you create a project, all cs files in your project will be compiled into one DLL. Instead, if you choose to create a website, all your app_code will be compiled and cached on the fly.

Resources