App_Code folder issues - app-code

The problem that your classes are not compiled, You'll solve this issue simply by going to the properties of any class in the App_Code folder and change it's 'Build Action' property from "Content" to "Compile"
But how can I set the property?

Right-click on the item in the solution explorer, and select Properties. In the properties window, there is a Build Action option.

Related

How To View the Project > References Tab and All DLL Paths in non-VB projects?

When you create a VB project in Visual Studio there is a 'References' tab in the Project Properties window. It looks like this:
It's rather a helpful window as it shows the paths to all the referenced DLLs in one place and lets you add and remove references easily.
However this same tab does not appear for projects in other languages making it very difficult to check the path for each referenced DLL.
Can this tab be made viewable or available for other projects? If not, what is the simplest way to view all the referenced DLL paths at once?
Unfortunately the reference tab for the other languages does not exist.
But you can try to edit the xml project, with these steps:
Show the context menu on your project in the window solution explorer
Select: Unload project
Right click and select Edit
Edit the ProjectReference element in xml file
Save and close xml
Reload Project (right click in solution explorer)
I know this is not what you wanted, but it could be a quick alternative to display the path of your references.

How to make project inherit it's settings from another project in VS2013?

I want to create a Native C++ project which inherits it's settings from another Native C++ project within the same solution, so if I were to change the settings from the base project, it will be reflected in the derived project.
Is this possible? I use the word inherit because I see that in the project settings, though I'm not sure where it's inheriting from.
Project settings sharing is done via Property Sheets.
Go to View -> Property Manager, right-click on one of your projects and select "Add New Project Property Sheet...". Choose some common place for it, that is easily accessible by all other projects (somewhere near solution file will do).
Double-click on that new property sheet and set whatever options you want your projects to share. Now you can add this property sheet to any other project via "Add Existing Property Sheet...".
It is inheriting from the solution. If you have both projects in the same solution then you can specify some of settings in the solution and have the projects inherit from the solution. You can then change the a setting in the solution and it be reflected in both projects.

"add view" in non mvc project visual studio

I have a solution where I have a MVC project containing all my views, and all other front end code. We also have another project (in the same solution) where I have the controllers.
If I add a controller to the mvc project and add a viewresult function to this conroller I can right click on the "return view(viewModel);" and choose "add view".
If I copy this controller to the "non mvc" project, I do not get "add view" in the right click context menu. Is there any way to get this ?
Yes - you need to add the MVC ProjectTypeGuid to the project file. Upload the project in Visual Studio and then right-click > Edit project file. Check to see whether you have a <ProjectTypeGuids> tag in your project. It may well be directly beneath the <ProjectGuid> tag. There are 3 guids in my MVC project but I'm not sure exactly which one(s) is/are needed. Start by adding all 3, reload the project, check you have the context menu, and then try removing them one at a time to isolate which is needed. I don't think it will harm the project to leave them all in though. Here's the tag from my project file:
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
EDIT: Not sure whether this will give you the in-view context menu but it will give you the solution explorer, right-click > Add View context menu.
EDIT 2: Yes it will, just tried it.

Error while removing project dependency in VS2010

I have a large solution with number of projects.
Some the projects depend on others (never a circular dependency though).
When I tried to remove a dependency of a project, I am getting an error message like "The dependency was added by the project system and cannot be removed". What is the cause for this error? How I can solve this?
I sometimes get this problem when I try to manually edit projects/solutions generated by our CMake system. I solve it manually:
Open the dependent .vcproj file in your favorite text editor.
Find <ProjectReference> tag corresponding to the dependency you want to remove (the include attribute of the tag will contain the name of the dependency project).
Remove the whole <ProjectReference> element (i.e. starting with <ProjectReference> and ending with </ProjectReference> inclusive). Save the file.
Reload the solution.
I faced the same issue. But i could solve it by following
Right click project, select Properties.
Select Framework and References under Common Properties
Select the references thats not needed.
Click on Remove Reference.
Or =>
To remove a reference in Visual C#:
In Solution Explorer, open the References node under the project
node.
Right-click a reference and click Remove
To remove a reference in Visual Basic:
In Solution Explorer, right-click the My Project node for the
project and select Properties.
Click the References tab.
In the References list, select the reference you want to remove.
Click the Remove button
For Visual Studio 2013:
On C++ projects (hope the same for others too)
From the Solution Explorer, select the project and right click to select the properties
In the properties window, on left pane, select Common properties => References
Right side of the window, you have the option to Add or Remove the other dependency items.
Then select OK, to save
If your project only has the .sln file but not any .csproj, you may want to
check the ProjectReferences property and remove the reference project there
remove the section from Project to EndProject
also remove the related rows under GlobalSection(ProjectConfigurationPlatforms)
As an additional point to #malenkiy_scot's above, for ProjectReference items you want to keep, double check the project guid is the correct one for that project. In the dependent .vcproj file, find the ProjectReference tags as above, and for each you want to keep:
open the referenced project's .vcproj file in a text editor
find its guid in the ProjectGuid tag
compare this with Project tag for that reference in the dependent .vcproj file (not case sensitive)
if it's not the same, replace the guid in the Project tag with the one from the referenced project's ProjectGuid tag
save the project file and reload the solution
Visual Studio uses the project guid rather than name to determine dependencies. So if you've hand edited the name of the dependency but not the guid (as I did) you get the error.
In VS17 Right-clicking on the References node then selecting OptimiseReferences... is good for helping work out your dependencies. Also Right-click on the project and clicking BuildDependancies... ProjectDependencies that might be where your dependency is being set.
1- RIght click References of the project and click Add Reference...
2- Uncheck dependent projects from the solution tab
In the solution explorer window, right click on the project and
select "Edit project file". The project.csproj file would open in the editor.
Find the which nests the tag.
Delete the entire (along with the closing tag).

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

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

Resources