Visual studio connection properties issue - c#

Since a few days, I'm having strange behavior, when I want to debug a project:
It always opens the connection properties window, although I have no database connection set up in that project.
Maybe this problem occurs because I set up another project with azure?
Does anyone know how to fix this?
Thanks,
Dennis

You can try to exclude the file from your project.
Try this:
To temporarily exclude an item that represents a file
--> In Solution Explorer, select the item you want to exclude.
--> On the Project menu, select Exclude From Project.

In your project open up the Properties tab, and there probably is a Publishprofiles folder. Delete it. Afterwards, open up the Web.config file in the project. See if there is any <connectionString> tag and delete them all if you dont have database connections.

Related

Source file '' could not be found

I have some solution already created I need to work with, but I get these:
Warning 1 At least one file is missing the 'RelPath' attribute. SolutionName
Error 2 Source file '' could not be found C:\Users\me\Desktop\someDir\someDir\CSC SolutionName
I use VS Express 2013 for Desktop.
I get this error when I click rebuild solution
Why I get this error and how to fix it?
Create a backup of your project file.
In solution explorer, right click your project and unload it. Then right click again and "Edit project file".
There you can inspect your files. There should be a problem with one of them, like lacking a file name, or something different from the other files.
Remove the attributes regarding that file, save the project, right click, reload project.

Error while publishing an ASP.NET application

There is a web app I'm trying to make publish in order to upload it by CuteFtp Pro.
I usually being doing this with no problem. But this time, I'm facing crazy error! Actually, as I right-click the solution and click to Publish using File System option choosing an appropriate path for that, finally I got an Error:
Error
Copying file Images\512px-Icon_-_upload_photo_2.svg.png to obj\Debug\Package\PackageTmp\Images\512px-Icon_-_upload_photo_2.svg.png failed.
Could not find file 'Images\512px-Icon_-_upload_photo_2.svg.png'.
0 0 GiftShop
I really don't know and have no idea about this error since there is no file by the name of
512px-Icon_-_upload_photo_2.svg.png
In fact, I never had an image by that name through the project!! What could be the reason?
I'm really getting frustrated in challenging with that error.
Anybody could help me on this please?
Thank you so much
This basically happens whenever we delete the contents from the folder but forget to remove from Visual studio solutions.
To Resolve this follow below steps:-
Go to visual studio solution explorer and right click on the specific content
exclude(yellow marked files) from project.
right click and remove those files from visual studio solution explorer.
Hoping this will help you :)
Try removing the file from your project (right click and exclude).
search for the string name of file in all the files of the project. Remove the line and you are done.
Whats the best guess is that it must have been referenced in one of the CSS you are using especially if you are using Jquery or any of its plugin..
Do one thing exclude your obj folder from project.This is the best way for those kind of errors.
In your solution explorer there is one tab with tool tip "Show All Files".Click on it and it will show you all files.
There is one another way
Update: went into Project --> Package/Publish Settings, and clicked "Exclude generated debug symbols." The project began publishing with no issue.
one more solution for you
Are you seeing the file in the project? If so right click and tell it to remove the "ghost" file from the project. Once you do that I would try and publish again.
If its not showing the project, you might be able to create a fake file with the same name (just put some text in there so the size isn't 0kb) and in the same location as the other asp files. Make sure the "show hidden files is selected" and add it to the project and then promptly delete. This would essentially fix the corruption of VS thinking the file exist.
Hope it works.
Look into your solution and exclude this image file, but remember to click on Show All Files, and try to rebuild the solution.
Update 1
I ran yesterday with the same issue, it was an image not included in the project. Please go to Solution Explorer click on Show All Files and check 512px-Icon_-_upload_photo_2.svg.png image is included in the project or not, if it in gray color so it's not included in the project and if has a yellow icon please remove it from the project.

Can't rename Visual Studio 2010 Project

I have a Visual Studio 2010 Solution, that is also under source control (TFS 2010). Usually, I have no problem renaming a sub-project; just right-click, rename, and life is good!
However, I now have one project that I'm trying to rename, but whenever i right-click, type in a new name, and then hit enter, it goes right back to the old name!
I must be losing my mind here!
You probably already have a file with the name you are trying to use on the filesystem though not as part of the solution/project.
Use the windows explorer to find and delete this file and you should be good to go.
In the end it seemed like a TFS issue. THere was a lingering shelveset that was mapped to the project that wouldn't allow me to modify it at all. Once I was able to get my TFS admin to make the necessary changes, all was well!
Just try to do Reset Settings
The command "devenv /resetsettings" will restore Visual Studio back to its original factory state. If you have previously saved your settings from option 1 above, you can pass them as a parameter: "devenv /resetsettings ".
Or else if you have saved any previous settings try to import by this path "Tools" > "Import and Export Settingsā€¦" and your problem get resolved.
If this is v1 sorry you can't rename it as it is mentioned here http://social.msdn.microsoft.com/forums/en-US/tfsgeneral/thread/9e50138e-46f2-4f7f-ba09-e5624d30250b/
I tried to go offline from TFS but it gave no results =(
So, then I tried to delete 'SolutionName.suo' file and it made the trick! I was able to rename my project. Buggy VS 2010 =(

Visual studio - can't remove project configurations

I have a major problem with project configurations. Everything started when I wanted to add new solution configuration (named "Dev_WithSource") based on existing "Debug" configuration and checked "Create project configurations". For some reason project configurations were registered inside sln file, properly showing in Configuration manager, but "PropertyGroup Condition" blocks in csproj files weren't created. That resulted in "OutputPath not set ..." error.
So, I tried to repeat whole procedure. After deleting all lines mentioning "Dev_WithSource" from sln file, "Dev_WithSource" project configurations are still showing in configuration manager. I searched all csproj and sln file in my solution. Neither of them contain text "Dev_WithSource".
After all that I event tried developing add-in. I can fetch phantom configurations with project.ConfigurationManager.ConfigurationRowNames but I also can't delete them.
Am I missing something? Are those configurations stored in some other files and not csproj/sln?
Thanks.
Access the configuration manager in one of two ways:
From the menus on top: Build > Configuration Manager...
From the drop down listing your configurations on the main tool bar select Configuration Manager...
In the configuration manager dialog under Active solution configuration: choose <Edit...> from the drop down.
A dialog opens showing all the configurations for your solution. Here you can select and click the Remove button.
Right-click->Unload your project with the configurations you want to remove.
Right-click->Edit project file xml directly.
Delete the Property groups containing conditions containing the name of the platforms/configurations you wish gone.
Save and load project again. Unwanted configurations should be gone.
If a configuration seems set up right but OutPutPath is still "not set", try moving its propertygroup tag up in the xml.
Let's suppose you want to remove "Release" configuration from the entire solution and the projects. So, first you go to Tools -> Nuget Package Manager -> Package Manager Console.
Copy and past the following command in the console to remove the build from all the projects. You may want to replace "Release" with the configuration name you wish to delete.
Get-Project -All | Foreach { $_.ConfigurationMAnager.DeleteConfigurationRow("Release") }
Finally, remove the configuration solution-wise as explained by Mike Grimm's answer.
I know this is an old thread, but this was the answer for me:
In the Configuration Manager, select "Edit..." in the "Configuration" column for each project (not via the dropdown named Active solution configuration) that has configurations you want to remove.
In the dialog that pops up, mark each unwanted configuration and select "Remove".
Copied from How do I remove a project configuration in Visual Studio 2008?
You need to remove the configuration from the solution AND the project. From the Configuration Manager:
Active solution configuration > Edit > Remove
Project contexts > Configuration > Edit > Remove
I solved this with utility which parses csproj files and inserts necessary propertygroup blocks into csproj files. Old project configurations still appear in configuration manager but I gave up trying to delete them.
In my case the issue was that the solution file was not in the same folder as project file so I had to copy the nuget folder into the solution folder to resolve this issue.
In Visual Studio for MAC -
Double click your Solution > Configurations > General.
Click on your 'ConfigToRemove' in the list then Remove (Ensure you tick delete also Configurations in Solution items), then Yes.
Click OK to save your changes.
Now, right Click on Solution and Tools > Edit File.
Go to "GlobalSection(SolutionConfigurationPlatforms) = preSolution" and remove all the Configurations you no longer need otherwise they will still show up in Configuration Mappings even though there are no mappings in the project!
Save and your done.
I know I am bit Late but here is complete solution.
To remove configuration completely from solution and project property then open .sln file in any IDE as Plain text and delete all information regarding the configuration.
NOTE- don't delete GUID values and debug/release configurations
Then open .vcxproj file in XML format and delete all information regarding the configuration. This includes fundamental property for it, Platform Toolset and Assosiated property elements in XML language.
NOTE- make sure to delete end tags.
when you go back to visual studio, click replace all and you are good to go.

How to edit .csproj file

When I am compiling my .csproj file using .NET Framework 4.0 MSBUILD.EXE file, I am getting an error: "lable01" not found in the current context of "website01.csproj".
Actually, I need to add every ASP.NET page with its code-behind file's reference. I've done it, it's working fine, but the above error is pending.
I hope it means that I need to add form name "LABLE01" in that .csproj file, but I do not know the syntax. Anybody please do provide me with the syntax to add form name in .csproj file.
The CSPROJ file, saved in XML format, stores all the references for your project including your compilation options. There is also an SLN file, which stores information about projects that make up your solution.
If you are using Visual Studio and you have the need to view or edit your CSPROJ file, while in Visual Studio, you can do so by following these simple steps:
Right-click on your project in solution explorer and select Unload Project
Right-click on the project (tagged as unavailable in solution explorer) and click "Edit yourproj.csproj". This will open up your CSPROJ file for editing.
After making the changes you want, save, and close the file. Right-click again on the node and choose Reload Project when done.
Since the question is not directly mentioning Visual Studio, I will post how to do this in JetBrains Rider.
From context menu
Right-click your project
Go to edit
Edit '{project-name.csproj}'
With shortcut
Select project
Press F4
You can right click the project file, select "Unload project" then you can open the file directly for editing by selecting "Edit project name.csproj".
You will have to load the project back after you have saved your changes in order for it to compile.
See How to: Unload and Reload Projects on MSDN.
Since project files are XML files, you can also simply edit them using any text editor that supports Unicode (notepad, notepad++ etc...)
However, I would be very reluctant to edit these files by hand - use the Solution explorer for this if at all possible. If you have errors and you know how to fix them manually, go ahead, but be aware that you can completely ruin the project file if you don't know exactly what you are doing.
There is an easier way so you don't have to unload the project. Just install this tool called EditProj in Visual Studio:
https://marketplace.visualstudio.com/items?itemName=EdMunoz.EditProj
Then right click edit you will have a new menu item Edit Project File :)
in vs 2019 Version 16.8.2
right click on you project name
and click on "Edit Project File"
Here is my option to Edit the project file without the need to Unload the project:
Open Solution Explorer and switch to folder view:
Navigate to the Project which you want to edit inside the Solution folders and right-click on it.
Choose Open from the Context Menu.
That is it!
You will see the *.csproj file opened inside Visual Studio Editor.
After you can switch back to a Solution/Project view (see step 1).
Update:
Starting from the Visual Studio 2019 (v. 16) you can edit the *.csproj file by double-clicking on the Project, just make sure that you have the option turned On from the settings.
For JetBrains Rider:
First Option
Unload Project
Double click the unloaded project
Second option:
Click on the project
Press F4
That's it!
Sorry, most efficient way with out stuffing your proj file is.
right click the file.
goto properties
where Build Action option is set it to NONE.
Do a build (yes you may get build error if you do even better)
go back to properties of that file
set Build Action option is set it back to Compile.
rebuild.
Congratulate your self for being smarter than everyone else and not ****ing you project. For me this exercise took under 10 seconds. Where as manually trying to input the compile... line into the csproj not only can render your project unusable but it is also impossible to maintain on large scale application. Better to keep source version control software to do the updates. If you need to cross merge branches then doing the above is amazing :).
To open the .csproj file:
open the solution explorer
1
Click on the Edit Project File option
2
You can also open the .csproj by double-clicking on the project file. So no need to right click and select edit project file. Just double click and that is it.
It is a built-in option .Net core and .Net standard projects
For Visual Studio-version: 8.1.5,
Right click on the project folder.
Click "Tools", then "Edit File".
A little late to the conversation but I found a better option.
In rider you can enable "open project files with single click"
Just go to the solution options menu and then click in open project files with single click

Categories