Can't find web application template in Visual Studio 2015 Community - asp.net

I have installed Visual Studio Community 2015 (DreamSpark program) on my Windows 10 N 64 bit machine.
But when I want to create a new web project, I can't see anything related to this.
So I launched the setup and watched if the "Web development tools" was checked or not and it was.
I unchecked it, then clicked next so VS Setup uninstalled these tools.
Then I re-launched the setup and checked it to install the "Web development tools" but it does not solve my problem.
I tried uninstalling, clearing all caches, install VS 2015 with another ISO re-downloaded in case that a file was corrupted or whatever, but I still have got this issue.
I tried to install manually Web Application templates using devenv /installVSTemplates -> does not work neither.
I tried to follow this article : http://blogs.msdn.com/b/heaths/archive/2015/07/17/removing-visual-studio-components-left-behind-after-an-uninstall.aspx
in order to remove all components related to VS left after a classic uninstallation but the setup encounters a fatal error..
I really need to work for my studies and I don't know what to do to make it work. I tried everything I've found on the web, tried to clean with CCleaner + manually delete cache folder ect..
But I still can't create a new web project because it just does not appear.
In Nugget Package Manager (inside VS), I can see that the ASP.NET package is installed (forgot the exact name but, this is the package related to what I am looking for) and I can't uninstall it to try a re-installation.
I'm trying to solve my probleme since 2 weeks ago but I still have got this issue.
Sorry for english mistakes.
Best regards,

Just to double check
Go to control panel "Add / remove programs" -> "Visual 2015" -> "Modify" , check that "Web developer tools" checked.
After reinstalling everything should reappear.
If you have already done this try..
(1) Please make sure that it is the latest windows 10 run windows update
(2) Run the command line:
Please check this folder in your system:
/Common7/IDE
You will find projecttemplate and itemtemplate, and you will also find projecttemplatecache and itemtemplatecache which are related to this templates issue, maybe you could remove them, and then run the following commands and see whether it can help you create the item/project templates.
devenv /installvstemplates.
devenv /ResetSettings.
Hopefully this fixes the issues
You can download this tutorial at http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-44-28-Documents/8420.Quick_5F00_Start_5F00_Azure_5F00_Webapp.pdf

Please also make sure that you are trying to add this item under a directory which can hold this type of file.

Go to Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE. Rename ProjectTemplatesCache folder and restart Visual Studio

Related

Issue with upgrading project to Visual Studio 2019

I upgraded existing web forms app (c#) from Visual Studio 2017 Enterprise to 2019. While code is working fine, when I open default.aspx page - I get 123 errors (while code compiles fine). If I open it back in 2017 version - no errors
I had addressed couple of the errors but not sure what to do with the rest. Especially puzzling that code compiles with 0 errors. Errors show only if I open default.aspx
Most errors are CS0103 - the name 'name here' doesn't exist in the current context
Few errors CS0400 - the type or namespace 'project name' could not be found in the global namespace
Few CS1061 - 'default_aspx' doesn't contain definition for 'Context'...
I don't understand how it still compiles without errors and works? What changed with upgrade that those errors popped up? All those names and namespaces exist and there were no changes other than upgrade. New requirements? How to fix it?
Found a solution:
This is happening to projects that are using v1.0.0 of Microsoft.Net.Compilers. To work around this problem you need to update to the latest stable version which is 3.0.0.
All errors disappeared.
Looks like something broken with VS Intellisense since the compile and build sueeccded.
1.Before you open the web form project in VS2019, navigate to its Solution Directory and delete the hidden .vs folder there, after that open the project in VS2019 to check if it helps.
2.If the issue persists, try cleaning the VS component cache after close all VS instance:
Go C:\Users\xxx\AppData\Local\Microsoft\VisualStudio directory, you can find many 15.xx and 16.xx folders there, feel free to delete all ComponentModelCache folders in them and restart VS.

Cannot Git Diff CSHTML Files in Visual Studio 2015

I am using Visual Studio 2015 with ASP .Net MVC 6 on Windows 10. As far as I can tell everything's up to date, but I haven't changed anything recently that I know of. In the last couple of days Visual Studio has stopped letting me compare the current version of an *.cshtml file to see what changes I've made. It works for every other type of file I've tried, only these ones are being a problem.
I am getting the error message "Failed to start the configured compare tool." I've seen a couple of other posts (like this one: Visual Studio 2015 using Git unable to compare files and Microsoft Git Provider and Visual Studio 2012 failed to start the configured compare tool) but they seem to be talking about a more general cannot diff at all problem, which isn't what I'm seeing. It's almost as if git (or VS?) has decided to pick just this one file type to not like.
I have tried creating a new ASP .Net project with a new git repository and it sees the same problem, and the problem goes away if I rename the .cshtml file to give it a different extension. I've had a look in the .gitattributes file but can't see anything, though if I'm honest I don't really understand how git works beyond the basic 'this is how you drive it around when it works'. I've also tried removing and reinstalling everything git related I can find on my PC with no joy.
Anyone have any ideas on what I could have broken?
Update: I've just found this https://github.com/aspnet/Tooling/issues/293 which suggests that it might be related to an ASP .Net Update. Guess I'll probably have to wait and see.
Clearing the MEF cache appears to resolve this also. Close the IDE and delete the contents of this directory:
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Clear MEF Component Cache (Open VSIX Gallery) will probably do the trick as well.
Likely related to https://stackoverflow.com/a/32376450/1154135
This turned out to be related to a problem with the new ASP .Net tooling. They've apparently got a fix to be rolled out, but until then there is a workaround:
In the options panel, go to Options->Text Editor->HTML->Advanced
Set Identity Helpful Extensions to False
This is as per https://github.com/aspnet/Tooling/issues/293#issuecomment-161382206
Check your .gitignore file for references to .cshtml files. Dollars to doughnuts that something like *.cshtml is in that specific repo. Can you run the diff in git outside VS?

BuildTasks.Csc task could not be loaded from the assembly?

I feel guilty asking a question like this around here, but I'm at a loss and would appreciate some help.
A proof-of-concept like web application was built on one PC and put up on a repo to download on another PC at a different location. There was originally an auto-build feature set up where Azure would build and publish automatically on check-in, but that was removed. Things were working on both ends until one side included a bulk of excluded changes. Now I'm seeing the following error:
The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be
loaded from the assembly
...\packages\Microsoft.Net.Compilers.1.0.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll.
Could not load file or assembly
'file:///...\packages\Microsoft.Net.Compilers.1.0.0\tools\Microsoft.Build.Tasks.CodeAnalysis.dll'
or one of its dependencies. The system cannot find the file specified.
Confirm that the declaration is correct, that the assembly
and all its dependencies are available, and that the task contains a
public class that implements Microsoft.Build.Framework.ITask.
Does anyone have any suggestions on where to begin looking for the issue?
It turns out that NuGet packages were committed to the repository and breaking everything. Deleting the project\project\packages directory from the repo solved all build problems since NuGet fetches the packages automatically on build.
I got this error when I created a new branch for my project.
It drove me crazy for an hour. I tried most of the suggestions over the internet including the accepted answer to this question.
I then closed the project, opened it again, cleaned it and the error is gone. So this means this could be cache issue.
Anyways, just wanted to share.
I too tried the top answer with no luck so deleted the contents of my bin and packages dir, closed and re-opened VS and everything fine now.
I have tried all solutions described before, but none worked.
What solved it for me, was to update the Microsoft.Net.Compilers from the NuGet Package Manager
Right-click on your solution.
Go to Manage Nuget Packages.
Search for Microsoft.Net.Compilers.
Install or update on dependent projects as necessary.
Re-build, clean solution and restart Visual Studio worked for me.
Deleting the package and cleaning the solution solved it for me.
Deleting these three directories solves the problem.
/packages
/bin
/obj
NOTE: delete both /bin and /obj from all projects included in the solution (including Test projects).
Problem hides on TFS, you need to remove folder TestProject...\packages from TFS, check in, delete it from your local dir and build again. Worked!
Use the below step:
1) Delete the package folder.
2) close the visual studio.
3) open the project and rebuild the project.
I delete all from packages folder and rebuild solution. It's worked for me.
In my case: this works for me.
It turns out my teammate had already started looking into Windows 10 development and had Microsoft Build Tools 2015 installed on his machine.
I installed the software from https://www.microsoft.com/en-us/download/details.aspx?id=48159 and the problem was solved.
In my case, the solution was:
Use Windows Explorer and navigate to the offending path:
C:\MyApplication\Code\Main\ABCProject\ABCProject.UI\Bin
Right click on bin folder > select properties > Uncheck ReadOnly.
In my case, the solution was:
Right Click on Solution.
Go to Manage Nuget Packages for this Solution.
Search for Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
Uninstall the searched Package.
Restart the Visual Studio.
I just tried this on a clean install of a Windows 10 machine and the issue for me ended up being that I didn't have the .NET 3.5 framework installed. This stackoverflow question helps explain why.
Cannot build WIX project on windows 10
Right Click on Solution.
Go to Manage Nuget Packages for this Solution.
Search forMicrosoft.Net.Compilers on Browse Section.
Deleting the bin folder worked for me
In vs2017 community there appeared a new item in the "build" menu. It disappeared after I used it and was called something like "Optimise project build packages". I clicked it and it fixed everything, just restart etc. I did it on two machines.
What it did was removed Microsoft.net.compilers 2.10.0 and replaced with Microsoft.CodeDom.Providers.DotNetCompilerPlatform 2.0.1
So there you go - more automagic...
My project was built with .Net Core 2.2 but I had .Net core 3.0 preview installed. I uninstalled .Net Core 3.0 from my system and went through all my class libraries, removing Microsoft.Net.Compilers 3.0, then rebuilt and it worked.
I moved my solution from one drive to another, and one of the files could not be copied because "in used", for which I click ignored, producing the error described in this post. Copying the missing file manually fixed it.
file: Microsoft.Build.Tasks.CodeAnalysis.dll
Destination directory: packages\Microsoft.Net.Compilers.2.1.0\tools
For me I was trying to open a MVC5 project in VS 2013 and I was getting this error, Opened it in VS 2017 and up it worked just fine.

Context menu has no "Add Scaffolding" nor "Add Controller" options

I'm trying to get started with ASP.NET/C#, and I'm doing so by following along some guides and tutorials.
One major issue I keep running into is that I have no Add Scaffolding in the context menu, nor Add Controller. I can't figure out a workaround for the lack of the Add Scaffolding.
There are various relate posts on SO. I will address some:
How to Add Controller
The accepted answer says something that directly contradicts my experience. There is no Add Controller option anywhere.
Reload the project
Reinstall suggested in this comment
I've tried uninstalling and reinstalling several versions. So far I've tried VS2013 Express for Web, VS2013 Community, and right now I'm using VS2013 Ultimate. Each one has had a fresh install installed within the month.
Add a guid
I tried adding a guid to a .proj file, an idea from another question at the moment of which I cannot find.
Same issue in Sep 2014, no answer
I realize there are several questions with the same issue, but none of the answers address my situation. Of the solutions I've seen proposed, I can't get any of them to work. Maybe I'm copying the guid's in the wrong place, maybe I'm not uninstalling correctly, I'm not sure.
I haven't yet tried to uninstall everything related to VS. I have a lot of random product on this machine. I wasn't aware that, for example, "Microsoft Visual Studio 2010 Tools for Office Runtime (x64) or Microsoft Visual Studio Tools for Applications 2.0 - ENU could disrupt VS2013 features. If anyone has information about this please let me know. I don't know the extent to which I would have to uninstall stuff in order to find the root of this issue. My Programs and Features menu is littered with MS product that I can barely tell apart.
EDIT:
Some Background Info:
I am using Microsoft Visual Studio Ultimate 2013 Version 12.0.31101.00 Update 4, and Microsoft .NET Framework Version 4.5.50938.
I used no special install instructions.
It's a web application. File > New Project... > Installed..Templates..Visual C#..Web..ASP.NET Web Application > MVC.
Upon Dleh's suggestion, I looked for the Add > ... buttons after changing the project type. I selected File > New Project ... > Visual Studio 2012 > ASP.NET MVC 4 Web Application (.NET Framework 4.5.1) > Internet Application, and I am confused to report that there is an Add > Controller... button. I have no idea what is happening.
Also, of note, I (within the week) installed VS2013 Ultimate on my home machine, and I have having none of these issues.
I believe I have solved the issue, but I don't know exactly what I did.
One answer from here was part of what prompted me to uninstall a number of MS products and features. Unfortunately, I can't remember the exact program or feature I uninstalled.
It seems like the uninstalling of related programs and features fixed the issue. By "related programs and features" I mean anything in the Control Panel > All Control Panel Items > Programs and Features menu that had ".NET" or "Visual Studio" or "Microsoft * Web Tools" or of the like. Many of them required a system reboot after uninstalling, and after one system reboot, the desired features in VS2013 was there.
There were on the order of 20-30 MS+VS+.NET related programs, and I uninstalled about 15.
I can't remember exactly which one I uninstalled, but it was anything that look remotely old and related to VS or .NET. Even if it was recent, I always figured I could reinstall stuff if I got the wrong thing.
Hopefully, anyone going through a similar issue will find this helpful. Good luck.
Had the same issue, installing
AspNetWebTools2013_1Setup.exe
WebToolsExtensionsVS.msi
fixed it for me.
Link Here

'Publish failed' but build succeeded?

When using Visual Studio 2008, when I "Publish Web Site", the application builds correctly, but then I get a "Publish failed" message:
What possible reasons are there for this, and how can I prevent it?
I had the same issue. Nightmare to identify the problem, because the logs and outputs show no errors or failures. I simply get "Build: 39 succeeded" and "Publish: 1 failed".
I resolved the problem by systematically removing all NuGet packages one at a time (and removing code that references it) until I identified the offending one.
This takes a LONG time!
However, the answer for me was Microsoft.Net.Compilers.
No idea how I ended up with that in my project, but as soon as I removed that package, everything publishes fine again.
Edit - For what it's worth, this problem occurs on VS 2008, 2012 and 2015 but does not occur on 2017.
You can try this:
Perform precompilation against the web application.
Clear the target directory(virtual directory in IIS or physical file
folder) and deploy all the files (of the web application) into the target
directory.
In the output window you can check at which stage does the publish website
operation fail. For example, at the first stage, if there are some error
which will only occur at precompilation, that will cause the stage 1 fail.
Or some times if the target directory has something configured incorrectly.
Such as the IIS virtual dir is not set to the correct ASP.NET version or
some old files are locked and prevent them from being cleared. Mostly,
publish failed will be caused by IIS side configuration issue such as
authentication setting....
Source link
You can open the output window by pressing Ctrl+W, O.
Sometimes it's because you need to be running VS as Administrator to be able to write to the target directory.
Check the Output messages, they should help you solve the problem
I had to copy project to C:\a\ and than publish. I suspect problems with long path. Strange, but worked for me.
The conclusion is: Try another VS edition and see if that does it.
Here is what did it for me.
I have VS 2013 Pro and Visual Studio 2015 Community. I sort of use one or another to work on my MVC project and all was fine. Then all of the sudden VS 2013 could not publish though it would build just fine. There was no erros other than some silly ...code is not returned from all paths...
So when I open it in VS 2017 - it published the same project just fine. I am suspecting a compiling issue - because that was the stage it would fail at.
Hope that helps you save a bit of time.
Not sure if this happens in different versions of Visual Studio, but at least in 2015 Professional Edition, the problem arises when we try to update all Nuget packages from the solution using the Packages Manager.
As pointed out by #SimonGoldstone the issue is caused by the package "Microsoft.Net.Compilers". By default, the package gets added to the solution while creating a new web application. The default version 1.0.0 does not introduce any problems. I was able to keep testing with latest versions until 2.4.0 and everything works fine, but from 2.6.0 henceforth is when it all starts. If an update is strictly required, I would recommend updating the aforementioned package until version 2.4.0. After doing some research, seems that some bugs on later versions than 2.4.0 are introduced and not fixed on the long term. What is curious though, is how this problem gets included on Nuget with no basic quality control checkpoint.
There are many proposed solutions for this. I think they are overcomplicating the issue.
I found the following worked for me:
Locate the obj(Release or Debug) folder in your solution
Inside the Release or Debug folder delete the CONTENTS of the 'AspnetCompileMerge' folder
Now try and publish.
Make sure you empty the target folder (manually) before publishing. Sometimes vs cant delete a file which will result in a failed publish
After trying a Rebuild, having other Projects in my Solution able to publish correctly, and changing my publish location to the C: drive (locally attached) instead of pushing to a mapped network drive, I was still having an issue where the only error output said:
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
My solution is targeting x86, but I think during a Git Merge, this project had it's profile switched to Any CPU. After creating an x86 profile for the project and having it match the target of the publish goal and of the active solution configuration, I was able to successfully publish again.
Check Project BIn directory. there must be a DLL of your page or control. which has to be recreated during publish. So exclude it or remove it
I ran into this same problem today and it was due to the Thumbs.db file that was created when I opened my images folder to look for an image. I deleted the file and the project deployed successfully. Hope this helps someone else in the same situation.
Delete publish profile and create another one . Worked for me
In my case, I was publishing to a directory in a mapped network drive, but the Output panel/window was indicating that the location didn't exist. The path was correct, and the drive was fully accessible. The problem resolved itself when I re-set the path to publish to in Visual Studio by using the ... button.
With me it was simple - the dist folder was locked. I unlocked it by an unlocker and the publishing resumed.
I have several user controls that are registered in the web.config, and have a ClassName in the .ascx file header. For normal builds everything works fine, but with a publish those class names were not recognized anymore. At some point I found out that the errors were not in my regular code files, but in copies in a temp directory for publishing.
I had "Precompile during publishing" turned on (to be found under Settings > File Publish Options). Turning that option off worked for me.
I had the same issue with VS2017 with a website project. Build worked, but publish gave me an error:
Error CS0012: The type 'System.Net.Http.HttpMessageHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
All my projects already had a reference to System.Net.Http so it was really confusing.
To fix it, I had to copy System.Net.Http.dll into my website project / bin folder so publish could find it and copy it to my web host. I found System.Net.Http.dll by looking at another project's references (a class library), then System.Net.Http.dll Properties, and seeing the path (C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NetFramework\v4.6\System.Net.Http.dll).
i know iam late but i think it should use for someone whos searching for this query.
just uninstall all your nuget pakages , then clean and rebuilt solution ,
now click on publish , sure it works and u will see publishing starts and works correctly now
If any one had changed the version of the project file and related framework. then this type of issue happened.
please go to "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\Web" location for visual studio published and build setting -> edit -> comment the force copy of all file section.
I had one file that was not found. I had copied in a png file to replace a jpg in the content folder , same name except filetype extension.
Project built fine, but refused to build and publish . changed extension of file so it could find that file name and it worked - no errors amazing 1 thing wrong and everything else is an error.
The case for me was that Visual Studio was not signed in to Azure, but provided no indication of that. I edited the publish profile, clicked "Validate Connection" then clicked "Save" and then it worked.
I was working on a feature branch, which was failing. Switched to Master Branch, deleted the feature one and created another one. It worked.
What caused my issue was a little different, but has similarities to some of the reasons stated above.
I managed to trash my local copy of a given application and did a GIT hard reset to get the most recent from the repository in question. This in turn, wiped out the web.config file (which was not stored in the GIT repository for various reasons).
This cause configuration information for various NuGet packages to be "lost" (since it was stored in web.config).
Fortunately, I had "backed up" the web.config, so once I figured out it was not out there (a migration failed because I was unable to connect to the database), I was able to replace it.
Tried the publish again, after fixing the web.config, and everything worked perfectly.
If you are opting for the "Delete all existing files prior to publish" in the publish web dialog box, then make sure that the Visual Studio is started with Admin rights. Right click the Visual Studio and click Run as Administrator. Hope this helps.

Resources