I have checked the answer for VS 2012, it did not work. I do not precompile, I have "Debug Info" set to "full", "Items to deploy" set to "Only files needed to run this application" and "Exclude generated debug symbols" not marked.
I have tested with "All files in this project", and I have tried to edit the pubxml file. Besides not working I cannot find the file schema documentation.
Please help.
After a lot of tests, I noticed that "Exclude generated debug symbols" flickered as marked during the publish processing. My error was that I was editing the Active configuration -- which was Debug -- and not the Release configuration used in my publish process.
Please verify the Configuration combo on the project properties page, this was bizarre until I noticed that.
There´s an option in the Advanced Precompile Settings dialog (which is off by default); you find this dialog via the Settings tab of the Publish Web wizard... watch out for the (unoticable) Configure-link in the File Publish Options-drop-down...
I've searched for this and tried every trick posted and nothing worked.
The only thing that worked for me was to take a copy of the bin folder and then delete all files from the bin folder and rebuild.
When publishing I got a new error of a missing .dll which I had in the backup folder. When I copied it to the bin folder I was finally able to publish.
Related
I've just updated my copy of Visual Studio to version 16.10, and something weird happened: when publishing a project, the "delete existing files" option is not editable anymore. You can see it but when opening the edit dialog there is no checkbox to edit it.
Here's a screenshot for clarification:
Is this a bug, or is it intended?
Is there an alternative way to set that option, or is it just not supported anymore?
I initially tried adding <DeleteExistingFiles>true</DeleteExistingFiles> to the pubxml file (under the Properties folder in VS). Unfortunately, this only update the Publish dialog but had no apparent effect on the publishing process.
For my workaround, I opted to add this to build event: del /S /Q $(TargetDir)publish. It clears out my publish directory on each build - you'll have to alter "$(TargetDir)publish" to fit your needs. The workaround is slight overkill, but arguably a better choice since there is less chance of the published files being picked up after a recent change/build.
I've just updated Visual Studio to version 16.11 and it seems they fixed it, the option is back in the settings menu:
Open .pubxml file in a text editor (mine was in Properties\PublishProfiles) and update/add the key DeleteExistingFiles to True.
I think regarding #Phil's answer, the 2 actions are doing different things.
1. DeleteExistingFiles
This will delete existing files on the web server when you actually deploy. I don't see any documentation about this setting from Microsoft which is frustrating. This same feature is available when you publish your application to a Web Deploy Package and use the Import feature in IIS to import the application. You will get a prompt like this:
This is the same as DeleteExistingFiles in a publish profile.
2. Publish directory
Deleting the publish directory is a different thing. The publish directory is a working directory of the msbuild /t:Publish or msbuild /t:Package commands. Basically what is in the publish directory is what ends up in the ZIP file used for a web deploy package or a publish profile. You can get issues during publish process with incorrect files in the publish directory. For example, https://github.com/scottksmith95/LINQKit/issues/157.
Unfortunately there is no way to delete or clean the publish directory with the existing msbuild or dotnet cli commands:
https://github.com/dotnet/sdk/issues/5972.
Fun times. So #Phil's del command is what we are left with.
I'm not sure why, but Visual Studio is not showing all the projects in my solution. I need them to show so I can set as default project under solution explorer. I'm not seeing a fix for this issue in a general internet search. The closest I see is VS not showing files folders, but this is different than my issue. Hopefully there is an easy way to fix it, without adding things again piecemeal. My co-workers can see their complete set of projects in solution explorer so it must be a corruption in my workspace.
Open your ".sln" project file using Notepad.
In this file you can observe listed projects like below
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.myProject.Data", "test.myProject.Data\test.myProject.csproj", "{6D7F7B84-F3BD-4A19-A069-D144C345B887}"
EndProject
Please add if there any missing projects. If you have old back up or co-workers file, Just copy and paste missing projects to this file.
In my case it works !!
close vs , delete .vs folder then open vs again. it works for me.
I found that re-adding the existing project to the solution worked for me!
I had to copy out changed files in my workspace, fix my permissions/ownership on my directory (it was no owner instead of me), re-do the mapped drive the workspace was on, re-do the shortcut to the Visual Studio project (even though it was supposed to theoretically be the same place I mapped), re-pull the project down, and copy my changes in again. At this point Visual Studio had the missing solutions in it again so I could set startup project and run the debugger. I'm not sure how the ownership/permissions got messed up. I think at one point the other office had a server go down, and maybe my permissions/ownership got mixed up then. I'm not sure why VS wasn't showing the missing projects, but it's fixed after doing the above.
I had the same issue where my colleague saw 1 more project on his computer.
I deleted my .sln file and got the exact same version as he. Problem was still the same.
Solution was: I had an unloaded project. Apparently this is safed in a local user setting file (probably the .suo file). I looked for the unloaded project and loaded it again.
Close the VStudio entire project, go to the main project folder and click on the .sln file to load the entire project agian.
go to solution explorer see which are having (unload), right click and load project with dependencies
sometimes check if the project startup has changed, if changed just right click on the related project and set as project startup
This .sln file structure breakdown offers a great insight on how projects are able to be found and populated into the project hierarchy. My .sln file had lost all its project persistence blocks and thus I had 0 projects under my solution. I copied the blocks from a a previous git commit and this fixed it. I still don't know why the blocks disappeared or the whole .sln file changed
If the other solutions didn't work for you, then try this.
You can add the missing project to the solution file using the dotnet command. To do so, go to the root folder of your project and run the following command from the terminal:
dotnet sln add ProjectLibrary/ProjectLibrary.csproj
The ProjectLibrary/ProjectLibrary.csproj is the path to your missing project.
You can open the .sln file to confirm if the prject has been added. You should see something like:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectLibrary", "ProjectLibrary\ProjectLibrary.csproj", "{F042B1DB-F887-44CC-941A-76569A86AF75}"
EndProject
Hope this helps.
I had the same issue. After opening the Visual Studio in Administrator mode it started to work.
Search for VS->Right click-> "Run as administrator"
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.
My project files are controlled by Perforce and I have installed the SCC plugin so that I can work directly with Perforce inside Visual Studio 2010.
Here is the problem I have:
Inside the project, there are several files that I don't want to take into consideration while I build the project. If I use the context menu "Exclude from Project", I saw the following warning message:
Checked out items cannot be deleted by your source control provider.
If you continue with the change, you may need to manually delete
xxx.h in the source control database.
Is there a workaround that I can use?
Thank you
If you simply do not want them to compile, select the code file and look at the Properties window. Set Build Action to content or some other non-compile setting.
I am publishing a web application from Visual Studio 2010 in IIS. The solution structure is depicted below:
Now everything is fine, except the Log4Net.xml is copied into the bin directory of the published forlder, while Data.xml is copied in right place. So I am manually copying the Log4Net.xml.
Why this is happening? Is there any script I can write for this publishing process?
Right click on Log4Net.xml and go to Properties.
Change the Build Action from 'Embedded Resource' to 'Content'
Change Copy to Output Directory to 'Copy always'.
You can control how the resource is handled by looking at the properties of the file in Visual Studio. There's a property "Copy to output directory", which will cause it to be sent to the "bin" folder on publish. There's another property "Build Action", which you can set to compile, resource, embedded resource, etc. Check those two properties for the file that's getting deployed correctly, and you should be good to go.