Visual Studio 2015 build solution does not work - c#

Sorry I am kinda new to C#/.NET and Visual Studio.
The project was built by my supervisor, and I am suppose to make some changes on it. I tried to make some changes on the ModuleController file, but when I click Build Solution, it runs, but it did not affect the website. The controller contain SQL function, even if I make any changes on this file (including delete the entire code), and then refresh the webpage, it can still run the SQL function which has been deleted and output the result.
And when I try to Rebuild Solution or Rebuild Website, I get "circular file references are not allowed". I add batch="false" to Web.config file, it can run, but still get the first problem: the code could not reflect on the webpage.
I have read http://www.gitshah.com/2011/04/how-to-fix-circular-file-references-are.html, but I have checked my folder, there is no ascx files. Only one Global.asax file...
Why is that, is there any possible solutions?
Could anyone helps me? Thanks.

Related

Visual Studio 2013 only builds HTML changes, not C# changes

I am building a personal website using asp.NET's webforms in visual studio 2013 express for web and am following this tutorial:
http://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/introduction-and-overview
My page is structured exactly the same as in the website, I have changed some minor stuff to make it my own but the structure in terms of the C# classes and how the interact with the HTML are exactly the same.
I got to section 5 of the tutorial "Display Data Items and Details" and everything was working fine. I've used git a lot in the past so I decided to create a repository for this project so I can access it at work if I feel like.
Suddenly now when I make changes to the C# classes it won't build. It's even stranger because I if I make a change on an HTML file the change is built. In section 3 of the tutorial we learnt how to make the 'product' classes which are displayed on the products page. If I want to change one of the product names for example, when I build the change is not there. Simultaneously I went and changed some info in the HTML for the contact page, IT CHANGES when I build. Why wont the C# changes take effect when I build any more?
I am relatively new to both asp.NET and visual studio. The HTML changes when I build and the C# does not. When I change either I can see in solution explorer that there is a red tick for pending changes. Why would only the HTML pending change be included in the build and not the C#? How do I ensure that the build is actually building the version I see in my editor window?
EDIT
I do not know if I found the original cause but I found a solution/workaround. I realized that the classes mentioned above were grabbed by the html page from the page's database. The .mdf file for the solution was not being rebuilt whenever I cleaned and built so I physically deleted it and rebuilt the solution and voilla my C# changes occurred. I am still fairly new to this whole thing, can someone explain what the .mdf file does and why it wasn't being rebuilt?
Check your .cs files properties on the properties window in visual studio to make sure their Build Action is set to "Compile", Things that are not set to "Compile" do not get compiled. How MSBuild treats project items depends entirely on their build action. CS files default to "Compile" when you make them, but if you changed them yourself that would be why it doesn't update. Also CS files placed in the App_Start folder default to "Content" and they are compiled by ASP.Net when the Application Starts, so if you changed something in App_Start you need to reset the site.
Not exactly sure what is the problem, but I would do a right mouse click on the solution in Solution Explorer->Clean Solution, then do another build and see if that helps.

can't update anything in c#

Anything that i change does not reflect when i run it. i don't know what happened it just sort of happened. i can't find anything on the internet except one where it says to build the solution which i already did and it was successful but it did not solve my problem. I tried editing the text putting a lot of buttons. I can see them getting added in the designer but nothing is reflecting when i run it or click the play button. Please help me. Thanks in advance.
I am using visual studio 2013
If its a web project, Clean the Temporary Files stored in framework folder,
%WINDIR%\Microsoft.NET\Framework
If its Desktop App, Delete the Debug Folder, both in bin & obj folders

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.

Check In: Operation not performed Could not find file *.csproj.vspscc

I am having issues with check in my code files because of some changes I have made to the project and solution. I have renamed project files, added different project files in the solution and added many files in the existing project.
Now I am getting an error while checking in the code.
The error details are:
Check In: Operation not performed Could not find file
'....Console.csproj.vspscc'.
How do I create a vspscc file if it does not get created on its own?
Any help would be great and thanks in advance.
This looks pretty stupid on my part. I restarted my Visual Studio and I could perform the check in because Visual Studio created the vspscc file when it opened the projects and solution.
Answering my own question as fast as possible so nobody else prints my own negligence before me.
And for anybody who needs an answer as how to create a vspscc file, restart the visual studio IDE
I have also seen this in another situation (VS2012) where a simple restart didn't do the trick.
I had a number of new projects which I had added to an existing solution but in the wrong place. Undoing and re-adding seemed to be fine until check-in, where it complained that the newly added projects and related .vspscc files could not be found. It was looking for them in the original location rather than where they are now.
Resolution was to go to the Source Control Explorer, which still had check-in items against these files in their original (but non-existing) locations, as well as the files in their correct locations. Selecting these errant references and "Undo pending Changes" for these files did resolve the issue.
I'd try using File/SourceControl/ChangeSourceControl dialog and unbind (if necessary) then rebind the project to TFS to recreate the .csproj.vspscc.
I removed projects and have same issue, so my solution was to re-create the same projects with same name, then remove them cleanly :-) I hope this helps
I had a similar problem, but in my case I Visual Studio/TFS couldn't fine the .csproj file. Anyway, with the help of a colleague I was able to determine that the issue was within TFS itself. TFS may have a different view of your source code than Visual Studio does. I had created the wrong type of project (I'll call it Proj1) and deleted it from within VS. Then created the correct project type, which I'll call Proj2. When I when to check it into TFS it complained about Prog1.csproj, which confused me because I couldn't see it within VS. What I learned was that you have to go into TFS's Source Control Explorer. From there you'll see how TFS sees things. Sure enough, there was Proj1.csproj (and some other related files to Proj1). What I had to do within Source Control Explorer was undo the pending check-in's of those files and folders which I didn't want to check in and no longer existed anyway. Then TFS was happy and I could perform the check-in.

C# - Visual Studio project build

I have the following problem.
I made an application in C# (using Visual Studio 2010). Everything worked fine.
Then I had to make some changes in a "main.cs". Did those... all fine again.
Then I had to make other changes in same file. Did those... cleaned the solution built it. The problem is that when I run/debug/anything the application I get the same result as I did before I made the changes. I even tried to break the code (called a random function that didn't exist, used wrong syntax), but the result was the same "Build successful" and the old version.
Is there some kind of cacheing mechanism or something? How do I get rid of this problem?
I added prints for the "compile" solution... I can't find the build property.
Try deleting the bin and obj directories in the Visual Studio project directory. The obj directory contains the temporary files used to create the binary while the bin directory contains the binaries for that project. In addition, check if there are any warnings being shown when you build your solution.
I was able to reproduce the same error i.e. build successfully even though the file has not been compiled. The Build Action of the file had not been set to Compile.
The correct Build Action for a code file (main.cs) would be Compile.
According the updated question the file properties does not have the compile option
The reason for this is that the file (main.cs) has not been included in the project, but the "Show all files" button is "on" in the Solution Explorer. The file has not been included in the project (hence not compiled) and the file icon is greyed out in Solution Explorer.
To include this file in the project, right click on add existing item to the project (see following image). In the subsequent dialog select the file (main.cs) and click on the add button.
This should solve your problem.
In future, it is best to keep the "Show All Files" button as "off" to avoid confusion.
Is it possible you have selected the build and run last successful version? Check out my answer to something similar here. If the changes you made broke something and you had checked the boxes and hit yes to the dialog boxes in my answer below then that's most likely the issue.
Cannot see changes I make when I run my application in Visual Studio
Make a backup of your solution.
Delete the .cs files from within the solution explorer. If your program compiles and runs, than you are linked to source folders and not actually using the one in your solution.
I doubt this is it, but worth a try. The other things that came to mind you have already eliminated out with the previous answers.

Categories