ASP.NET, VisualStudio 2010: Web.config not publishing? - visual-studio-2010

For some mysterious reason, all of a sudden when I publish my website, Web.config does not get coppied over.
At first when I saw that the properties of Web.config was set to "Do not copy", that seemed like the reason... but when I change the option, it doesn't stick.
Is there some shortcut key or some global TFS setting that might effect this?
This has never happened before...

Apparently, if you look at "Properties", there is an option called "Build Action" ... set this to "Content" if you would like this file to be coppied over on Publish. If not, select "None"
Reference: http://forums.asp.net/p/1528920/3698633.aspx

In Solution Explorer> Right click on Web.config file > Properties.
In the Properties dialog box,
set Build Action = Content
set Copy to Output Directory = Copy always

Related

The item is already under source control at selected location

How can I add a Visual Studio solution to the TFS? I created a new project named, for example, PROJECTX and I have solution with the name PROJECTX.sln. I select File > Source Control > Add Solution To Source Control, but immediately I get this error:
I also deleted and recreated the same project in TFS and my solution does not have any .vssscc files, therefore I think it wasn't in TFS before, maybe some other copy... but when I deleted the project in TFS, it should not matter, right? I tried the bind/unbind option, but it seems that I'm missing something important. Also I don't have any pending changes and the TFS project is empty on the TFS server.
If I select the Ignore All option, I cant check in the files, because it tells me it is already checked in.
On my case, I had to correct the binding using the Change Source Control dialog box :
Select solution or project that you want to add to source control
Go to "File" -> "Source Control" -> "Advanced" -> "Change source control" (if you look at Microsoft website, you will see that there is not "Advanced" menu in their example, it may be related to VS version or menu settings).
Click "Bind" on each row.
If a row in underlined in red, it may indicate that the current project is not checked in into TFS, check-in all project before you proceed to the binding.
Microsoft - How to : Bind and Unbind Projects and Solutions
Close the solution .
open the solution file in notepad
Then remove the below section.
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {3CF58AB4-18FA-4F8D-95D4-32DDF27D189R}
SccTeamFoundationServer = https://serverIP/Project
SccLocalPath0 = .
SccProjectUniqueName1 = Ecample\\Example.csproj
SccProjectName1 = Example
SccLocalPath1 = Example
EndGlobalSection
then open the solution once again it should prompt to bind, do the binding properly.
I solved this issue by copying the project folder to the new windows folder outside of local tfs workspace.
I had the same. I first created a new folder in TFS, then in File Manager, copy the whole project w/o .sln file to this folder (TFS already created in file system), back in TFS, clicked on "+" icon to add everything underneath this new folder.
Then checked in for the first time.
Continued working on the project made some changes. I thought it's okay to "Add Solution to TFS", still the same problem, even though removing all .vss files/folders.
Since I know TFS already has a copy, so I "Compare" it with my local version see the difference there.
So I just clicked on "Ignore All" button, Bingo, works.
This is how you need to bind the solution to the server
I followed these steps:
If you're already in Visual Studio with the solution opened, close the solution via: File > Close solution.
In Source Control Explorer window, in "Folder" section (left side of the screen), navigate between your TFS projects, find and open the solution you want.
You'll get a message saying:
The solution you are opening is bound to the source control on the
following Team Foundation Server: your_server_folder.
Would you like to contact this server to try to enable source control integration?
Press Yes and if the connection is correct, you'll see now your solution is bind to source control.

How do I set the start URL of a Visual Studio project globally?

I need to change the start URL of a project. When I set the start URL on the property page, it gets written to the csproj.user file and not the csproj. I tried putting the <StartExternalURL> in the csproj in the <WebProjectProperties> section, but that did not work.
Is there any way I can set that property and propagate it to the entire team, or is everyone just going to have to make the change manually?
You should add the csproj.user file under source control. When everyone checks it out, their start URL will be set correctly.

What could prevent VS 2008 from deleting a file that I can delete manually?

I'm trying to build a project using Visual Studio 2008, but I'm getting this error:
Could not delete file '<filename>'. Make sure that the file is not open by another process and is not write-protected.
The file is most definitely not write protected (it was, but I changed it), and I don't think it's in use by some other process because I can delete it without a problem in windows explorer.
What might prevent Visual Studio from deleting it?
I fixed this error as follows:
Select all projects in the Solution Explorer on the left.
Right click any of the selected projects and choose "Properties"
Choose "All Configurations" from the Configuration pulldown menu.
Choose "All Platforms" from the Platform pulldown menu.
Pick "Configuration Properties" on the left, then "General".
Edit the "Output Directory" entry. By default it has a value like "$(SolutionDir)$(PlatformName)\$(ConfigurationName)". Change this to point to a directory above $(SolutionDir). Say your $(SolutionDir) is "\Code\$(ProjectName)", try setting "Output Directory" to "\Code\Build\$(ProjectName)\$(PlatformName)\$(ConfigurationName)"
Edit the "Intermediate Directory" entry and set it to "$(OutDir)". This puts intermediate files in the same place as the "Output Directory" entry. This step might be optional, but it's how I have it set.
I'm not sure why VC2008 has this problem but I'm guessing that it has a separate thread that's always scanning files in $(SolutionDir) and randomly preventing them from being deleted. When I had Output Directory within $(SolutionDir) I would randomly get errors trying to delete files during build and it seemed it could happen on any file. My builds would fail as a result about 90% of the time. Running VC as Administrator as suggested in comments below the original question did not fix the problem for me, nor did replacing all file permissions, running chkdsk /F, or rebooting. I would also theorize that this problem becomes gradually worse as your project becomes larger and more complex.

How to make the Visual Studio compiler ignore a file?

Is anyone aware of a way to make visual studio completely ignore a file when compiling? I have a C# solution that has a foo.config file that isn't really a standard config file - it's just a text file. During compiling VS grabs a hold of the file and bombs.
I'd like for it to act as though it's just a text file. I do not have the option of changing the name of the file.
EDIT: Please note that BuildAction does not exclude files from the compiler checking them. It simply decides if the file is compiled into the assembly, whether it's content (like a jpg or something), or whether it is a resource file. For more info: see the MSDN page.
EDIT2: Apparently, if you have a text file that is named foo.config and you have it open while building, VS2005 will pop up an error thinking that the file should be xml. However, if you close the file, VS2005 will ignore it.
Solution: Visual Studio validation causes errors if you have a non-compliant file open during build time. For an example of how to turn this off (for HTML), see Scott Guthrie's post. As Allen mentioned, you should also have the Build Action turned to "None". Unfortunately, this will not stop build errors if you have the file open.
right click > properties
Build Action: set to "None"
Edit: If you're talking about app.config, you really cant mess with the format of that, you need to put it in a different .config file.
I just double checked, VS.net doesnt care as long as its not app.config or web.config and the config file build action is set to "None", it will "error" if you have the file open but it will not cause the build to fail or keep it from building the assemblies.
Close the file and the errors will go away, similar to the errors you get about HTML markup. The displaying of these "errors" is probably a configurable setting in vs.net
The action to take depends on the solution and and file type. For instance (in VS2005), in a C++ solution I can right click on the source file name in the solution explorer and view its properties. The first "General" option is "Excluded From Build", which will allow you to exclude the file from the build process without having it excluded from the project altogether.
I pulled up a .config file in a C# solution, and found a "Build Action" option under the Advanced section. That should probably be set to "None".
Just right click on the file and choose "Exclude from project".
If you still want to see it in your project, select the project and click the "Show all files" button at the top of the solution explorer. This will show all the files in the directory tree even if they aren't actually part of the project.
Are you sure that VS compiling .config file???
You should check it's Build Action in file options and may be set it to none.

Setting the manufacturer in a VS 2008 Setup Project

I have a windows setup project that installs a service. All works well except for one thing: The default directory offered to the user during install is of the form "C:\Program Files\Microsoft\ProgramName". I am trying to modify this so that instead of "Microsoft" we would have our company's name.
I found the application folder property of the setup project, and it has a DefaultLocation property of "[ProgramFilesFolder][Manufacturer][ProductName]". So, it looks like all I need to do is set the "Manufacturer" property and I'll be all set. However, I can not find a way to set this property! I had hoped it would take it from the company name in the AssemblyInfo of the primary output project, but it did not.
I could remove "[Manufacturer]" from the DefaultLocation and replace it with our literal company name, but that seems like a hack.
How do I set the Manufacturer name?
Note that I am not using a full-blown WiX project. I have simply added a windows setup project to my solution.
Thanks in advance for any help.
Click on your setup project in Visual Studio, open the Properties and you will notice that there are a number of Properties that you can set like Manufacturer, SupportURL, etc.
Note if you're confused/frustrated doing this seemingly trivial thing: if you open properties by right-clicking on the project and clicking "Properties" in the right-mouse menu, you will get the wrong dialog box. You need to select the project, but then navigate to the properties tag. One way to navigate to the properties tag is from the "View" menu, select "Properties Window".

Resources