Local build works fine. One build server works fine (which isn't using a TFS Build).
The problem is that a TFS build packages the MVC3 binary, not the MVC4 required.
SERVER 1: Our TFS server has only MVC4 installed (though I don't believe this is needed anyway).
SERVER 2: Our TFS build controller has only MVC4 installed. (The build agents are on the same server).
Note: both SERVER 1 and 2 have had MVC3 installed previously.
I queue a new build, go to SERVER 2 (build controller server) and I see the agent is working (TFS Admin Console) and has created its working directory.
However the working directory eventually contains the MVC3 binary! This is then dropped in the drop location on a hosting server, which is then deployed incorrectly with MVC3.
An MSBuild from the command line on 'SERVER 2' also adds the MVC3 Binary to the bin folder. The GAC contains the MVC4 binary. (C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_4.0.0.0__31bf3856ad364e35)
The web.config of the project in question correctly references MVC4, and System.Web.Mvc (v4.0.0.0) is set to copy local. I have checked for MVC3 references extensively. I have no reason to doubt the code, as this works on our legacy build server (which has MVC4 installed).
And of course it all works on my machine, a publish contains the correct MVC.dll in the bin folder.
Where could it possibly be getting MVC3 from? What could I be missing?
SHORT TERM FIX: Install MVC4 on hosting server.
Finally solved this, there is a Reference Assemblies folder inside of program files that contained system.web.mvc.dll (version 3). I deleted it, and it everything works!
Simply put: ".NET version 4.0 made a big change in the way framework reference assemblies are done."
The answer in this question gives more details as to what this folder is and why it is there: Reference Assemblies folder and different assemblies with the same version.
Related
I made some updates to my ASP.NET MVC website, including a change to this ViewModel. It works 100% fine running IIS Express in Visual Studio after a build in Release. However, after publishing... it is not updating this specific ViewModel for whatever reason.
That property is 100% there. I have no doubt this should be working. Something is going on with either the publish or the IIS server itself. I think it is the publish, because I have been deploying the last build .zip file and it works fine. Only the recent publishes with this new update are acting up. It's driving me crazy.
Is there anything I can do to make sure this is publishing fresh or building fresh?
EDIT: I was able to manually copy my project's .dll file to my web server and it worked. Why would the publish not update my .dll file? I am publishing to a fresh .zip file each time.
If you change only the views, CSS, javascript, you could xcopy command to only the modified files but if you change the source code you need to recompile the application and redeploy it.if you change your source code you only need to xcopy your particular dll. No need to redeploy whole application unless you didn't split your application in multiple logical layers.
You can refer the below link for more detail:
how to make changes on a deployed Asp.net MVC website
Here's my setup. I have a classic .Net website, not web app. I have all my compiled objects in a self-hosted nuget repo. When I build in VS, it looks at my packages and copies the binaries to the bin folder but when I try and build in Azure DevOps it's not working. My Nugets restore just fine but I haven't hit on the right msbuild arguments to make it work. I know that .Net websites are not common these days. I found this (How to use NuGet packages with an ASP.NET Website on CI Server) which was a path I was considering (putting .refresh.dll files in source control) but it seems like there should be an easier way.
How do I get my nuget packages copied to bin during a build for a asp.net website (not web app)?
What you are considering (putting .refresh.dll files in source control) is the most appropriate way.
From here:
They are simple because if you view them in a text editor, you’ll see
they contain nothing more than the full path to the dll.
Turns out, these dll.refresh files are an exception to the rule, and
they should go into source control. Its the only way your web project
will know where its references live.
For building and package restore to work, you can keep the bin folder and any .refresh files. You can remove the other binaries from your version control system.
Hope this helps.
I am trying to deploy an web application that was created on VB with the .NET Framework 2.0 using the TFS 2017 continuous deploy. It doesn’t have a solution file inside like vbproj or csproj, so I needed to avoid all the suggestions to include extra information on the vbproj.In order to run the MSBuild even locally I need to change in my .sln this tag, so all my compiled code is also there
Debug.AspNetCompiler.TargetPath = "....\PrecompiledWeb\ARB\Debug\"
Unfortunately, I can’t deploy the application using the TFS. So far I tried to deploy it through my Visual Studio project, and is working fine with every option: I tried MSDeploy, Web Deploy Package, and FileSystem, and is working fine from the Visual Studio Publish Option
With that, even my transformation take place.
Now lets say I go to my TFS and I put this parameters on the MSBuild
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsASingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="\\MyServer\Content"
My files are compiled but never stored in my Content folder. No one of them!!! I can’t figure out what is going on here.
From your screenshot, you are using a Web Site project, not a Web Application project. The output structure of a Web Site project in TFS is different from build in VS (you can see a PrecompiledWeb folder in your build source directory on build agent server). Instead of using MSBuild argument, you can consider add tasks below to copy the files you want to publish:
We strongly suggest you switch from Web Site projects to Web Application projects to avoid these issues.
I am deploying asp.net web site via Octopus deploy. In TFS build definition I specified PowerShell script which pack and push Nuget package. Everything working working well except one thing: bin folder is not included in Nuget package.
When I tried to manually packing my web site into Nuget package I noticed that bin folder is included.
I supposed that something happened in TFS build process and bin folder is lost. But I cannot figure out how to solve this.
Any advice?
It sounds like you are trying to build a Website rather than a Web Application. Websites are only supported for legacy and don't get any love in the tooling. You can:
1) manually create your website layout for packaging with a post-build PowerShell script.
2) upgrade from a Website to a Web Application project and feel the love.
To upgrade you can create a new Web Application project in VS and delete all the specifics, like aspx files or other overwrites. Then drop the left over files on top of the Website, and open it in your solution. You will have two entries, one for site and one for app. Fix up the web app errors and build...
I have searched a lot and I have tried but couldn't published asp.net mvc 3 application on localhost. I have never tried before. I have currently adminpanel application running on development server of the visual studio. In my machine, following are installed:
IIS 7
windows 7
SQL server 2008
MVC 3
asp.net 4
In visual studio, I publish application using File System publish method and target path to C:\inetpub\wwwroot\adminpanel. And Following Directory and files were copied.
Directory
App_Data
bin
Content
Scripts
Views
Visual Studio 2010
Files
Global.asa
Packages.xml
Web.xml
I don't know but I think Some directory's are missing like the controllers, Helpers, Models, Sources which I have seen in Visual Studio Solution Explorer. When I browse to http://localhost/adminpanel, it shows all directory and files list in browser.
How to publish the application to IIS and use SQL server of local machine so that I can browse to particular controller like http://localhost/User/UserManager which I can do in the dedicated server of the visual studio.
I don't know but I think Some directory are missing like controllers,
Helpers, Models, Source which I have seen in Visual Studio Solution
Explorer.
That's perfectly normal. ASP.NET MVC 3 uses an ASP.NET application type (in contrast to ASP.NET WebSite) meaning that it is precompiled and all the source code is removed when deploying. Only the Views, Static resources such as CSS, Images and Scripts as well as the bin folder containing the compiled assemblies is deployed.
Basically, I think your Site has not been defined as a application in the IIS. You can do it from IIS manager.
But, instead, when you publish the the application, select File System but instead of browsing to the mentioned Folder, in Target Location field click the button next to the text box and select Local IIS on the left side. Now you can create a Application Folder and directly publish into it.