MVC: Visual Studio Publish Web dialog cannot find my application's Views - asp.net

I am using these steps to publish my ASP.NET MVC 4 application using Visual Studio 2010 on IIS 7.5 running on a 64-bit Windows 7 Professional machine.
When I click the Publish button on the wizard after entering the values, it reports a single error that reads:
Copying file Views\Shared\Error.cshtml
to obj\Debug\Package\PackageTmp\Views\Shared\Error.cshtml failed.
Could not find file 'Views\Shared\Error.cshtml'.
I looked into the target folder where the wizard dumps the necessary files that will be needed to deploy the application. It turns out that the folder had the Views folder which had only the _ViewStart.cshtml of the root Views folder, but no other View. My application has at least 20 views, perhaps more.

I realized that it was my fault. The local copy of my project had the file Error.cshtml in the Views\Shared folder. However, the TFS copy of the project file did not. Apparently, the file had been excluded from the project at some stage.
I excluded the file from my project locally and ran the build and it worked.

In my case the problem was that the file was in the solution but didn't actually exist on the local file system.

For me, this problem occurred when I moved a file (via explorer) from the shared folder to another folder.
I added the file in visual studio, but did not "delete" the file from the shared folder (as far as visual studio was concerned).
For some reason, visual studio did not put a little flag or warning sign to tell me the expected file was missing (even after a refresh), so I didn't notice (although trying to open the missing file revealed the problem).
The error message is clear, and self explanatory. I just couldn't understand it for some reason.

Related

.NET Core 31 - Single EXE - The application to execute does not exist

Converted an old .NET Framework project to .NET Core 3.1 yesterday. The application runs fine on my own machine and debugs correctly.
I have put both the following into my .vbproj/.csproj
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>win81-x64</RuntimeIdentifier>
However when I move the .EXE to a remote machine and attempt to run said EXE on that remote machine I get told that the DLL (for the project in question) does not exists.
I moved the .dll to the same directory that the exe is in (not ideal) and get the following error instead
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.
I used to use Costura.Fody to create a single file exe without any issues in .NET Framework, I was under the impression the above would do the same for the .NET Core packages.
Can someone point me in the right direction please.
For anyone else that may find this question and find it useless.
I was 'Building' the project instead of 'Publishing' the project, this in-turn wasn't creating the self-contained exe properly.
Don't be a donut like me.
In Visual Studio 2019, go to Build > Publish MyApp. This will open a tab in the editor area. Click on Show all settings to open the Profile settings dialog. Then click on File publish options and check Produce single file.

Visual Studio 2017 won't compile my ASP.NET web project, saying "could not load file or assembly" for a library that is definitely being referenced

Current Situation:
I have an ASP.NET web project. (Framework Version: .NET Framework 4.5.2)
One developer here is able to compile it and run it fine in Visual Studio 2017.
I cannot, I get the "could not load file or assembly" error for a reference that is in my list of references.
Screenshots:
Error:
Bin Folder:
Web.config Potential Relevant Sections:
DevExpress Licenses File:
DevExpress Library File's Details:
Things I've Tried:
Clean Solution & Rebuild Solution
Deleted solution locally and clean get of solution from source control
Clearing out my temp directory
Opening the project in Visual Studio 2015
Having the developer zip up his local copy of the solution / project and sending it to me (When I ran his copy locally I continued to get the same error.)
Re-adding the existing library it's complaining about
Manually deleting and re-adding all the libraries in my BIN folder
Messing with the license file, web.config, and assembly references in code (including adjusting the version numbers because for some reason the version number is 17.2.5.0 anywhere it's referenced in the project, but the file's Details actually says it's 17.2.9.0?)
Smashing my face into my keyboard...
...Always the same error.
Additional Information
Other developers run into the same exact error under the same conditions as me, only my one developer who's been working in this project can build it fine
I just noticed that on a new copy of the work project, my references window is showing 2 of the same reference to the DevExpress.Data library (one in the GAC and one in the BIN) but when I try re-adding the reference to my project, the one in the BIN disappears from my references window:

Visual Studio Copy the Project to an external drive

I had done a project by using ASP.NET MVC. How do I copy and paste the project to an external drive. I have to submit my project as coursework yet they request to copy the entire project to a CD/VCD.
The problem is when I copy & paste the project into a CD, it can't run properly with loads of errors. How do I do this in the cleanest way possible?
Snippet:
Here's the warning message.
You can delete .vs folder. Visual Studio will recreate it, when you open the project.
The main issue is Visual Studio cannot read and write to CD. However, you can copy the project into USB Flash Drive, and open the project straight from it.
Starting from Visual Studio 2012, Microsoft uses IIS Express by default to host ASP.NET applications, which relies on a file applicationHost.config to store the site information.
The design of applicationHost.config, means a physical path to your project directory is hard coded which prevents this project from running if you simply copy the project to another location on another machine without updating applicationHost.config. What's worse, starting from VS2015 this applicationHost.config lives in .vs folder inside your project directory, which can be copied to other machines by mistake.
Read my blog post to understand the technical details if you like,
https://blog.lextudio.com/jexus-manager-secrets-behind-visual-studio-iis-express-integration-834f88c8e8b

Visual Studio putting web app dll in \bin\x64\debug instead of \bin\

IDE: Visual Studio 2010
.NET 4.0 x64 running on Windows 2008 R2 x64
All projects are configured for x64 platform.
When I compile the web application project, it puts all the required DLLs in the bin directory...HOWEVER, the web application's DLL is inside the \bin\x64\Debug.
This causes the dev web server (I use ultidev but this affects VS web server as well) to try to load the web application DLL from the \bin\ directory..but because it isn't there, it throws an exception failed to load type 'Global' (global.asax page). If I copy the web app dll from \bin\x64\debug to \bin\, it works fine.
Why isn't VS putting a copy of the web app dll to the \bin\ directory?
In the project properties (right click on the web project, at the bottom click properties) open the "Compile" section. You should see "Build output path" with a textbox below it and a browse button. Change the build output path to "bin\"
Due to another issue this didn't help me directly but did get me thinking.
I had to right-click on my project, "unload", then right-click again and edit the project.xml which included the outputPath variable.
That one was difference somehow so I edited it to point to "bin\", saved, right-clicked on the project one final time, choose "reload" and went about business as usual.
That solved my problem along with the issue of my break-points not being hit (because I had old files in bin\ which weren't getting cleaned up thanks to the bad path).

Visual Studio 2010 doesn't deploy App_Theme folder

I have a simple web app project in Visual Studio 2010 (converted from 2008 project). For some reason when I publish the app, Visual Studio doesn't copy the App_Theme -folder to the publish destination folder. This will cause the app to fail when deployed to production environment.
App_Theme is considered as "system" folder by VS (shown as grey), which means that I can't manually set it's publish properties.
Can anyone tell me how to get VS to copy App_Theme -folder when deploying?
I had same problem, located and deleted TEMP folders with cached data about publish, and then publish gone fine.
%userprofile%\AppData\Local\Microsoft\WebsiteCache
%temp%\VWDCache
%LocalAppData%\Microsoft\Team Foundation\1.0\Cache
Hope this will save time for next people, hitting this problem.
I think Visual Studio has a cache file in the root directory where it tracks what files/folders have already been published. If you nuke that file, it should do a full publish again.

Resources