Missing bin folder in Nuget package - visual-studio-2013

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...

Related

How do I get my nuget packages copied to bin during a build for a asp.net website (not web app)?

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.

WebDeployment is not

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.

Perfered method for removing Roslyn folder from Octopus deploy nuget package

I've noticed that octopack is including the Roslyn folder under the bin folder for my web deployment. What would be the preferred method for excluding this from the build without affecting development. I considered a post build event in only the "release" solution config to delete it but wondered if there was a better way (and it doesn't need to be specific to octopus).
This folder is added by the Microsoft.CodeDom.Providers.DotNetCompilerPlatform nuget package. If you want C#6 support in Asp.Net (.cshtml or .aspx) files it needs to be there, because the roslyn's csc.exe from that folder is used to compile your views.
In order to be able to remove it (not deploy it), you'd need to precompile your web application with aspnet_compiler.exe

Deploying umbraco with TeamCity

First post on Stack, so please be gentle!
We are just getting into Continuous Integration with TeamCity. We have setup a TeamCity project(s) that looks like so:
Solution Build (builds entire solution) - .Sln file
Debug to Dev Server (builds .csproj in Debug configuration and Deploys to test server using MSDeploy)
Release to Production (builds .csproj in Release configuration and Deploys to production server using MSDeploy)
Within our Umbraco Visual Studio project (which is a Web Application not the standard Website project type) we have the umbraco_client and umbraco folders excluded from the Project, primarily because they are already compiled and don't need to be re-compiled by our process. Both folders are however included in the SVN repo.
The problem we are experiencing is that because these two folders are excluded from the Visual Studio project, TeamCity does not deploy them.
So my question boils down to "how do you include folders in the TeamCity build package where the folders are in the SVN but excluded from the Visual Studio project?".
Any pointers would be really appreciated.
Thanks
dotdev
We've been using TeamCity for umbraco. This is what we've been doing recently on our internal dev servers:
/p:Configuration=Debug
/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish
/p:MsDeployServiceUrl=OurDevServer/msdeployagentservice
/p:AllowUntrustedCertificate=True
/p:MSDeployPublishMethod=RemoteAgent
/p:CreatePackageOnPublish=True
/p:DeployIisAppPath=umbraco_site
/p:IgnoreDeployManagedRuntimeVersion=True
/p:FilesToIncludeForPublish=AllFilesInProjectFolder
/p:SkipExtraFilesOnServer=True
/p:ExcludeFoldersFromDeployment="media;App_Data\Logs;App_Data\preview"
/p:IncludeSetAclProviderOnDestination=False
/p:AuthType=NTML /p:UserName=
They key to solving the problem you are having is
/p:FilesToIncludeForPublish=AllFilesInProjectFolder
By default, it is set to something like "AllFilesInProject". Combining FilesToIncludeForPublish with the ExcludeFoldersFromDeployment can give you some control over exactly what TeamCity attempts to deploy
I would suggest using an approach similar to the one described in this blog post: http://blog.iqit.dk/2013/11/using-package-restore-in-umbraco-projects
You don't mention nuget, so assuming you use a zip or web pi to setup Umbraco in your solution, but you should still be able to use the targets listed in msbuild or add to your web applications .csproj when building your solution. It would require that you have the Umbraco and Umbraco_client folders somewhere in Svn repo or on your build server in order to copy it in.
As an alternative I can also recommend that you download the UmbracoCms nuget as that contains an extension to the msdeploy pipeline that includes the two mentioned folders in an msdeploy zip package. But again also based on the nuget install and thus a standard location for the Umbraco folders.
Hope this helps.
I've based my TeamCity builds on Troy Hunt's excellent "You're Deploying it Wrong" series - which is an excellent step by step guide to integrating Visual Studio based projects and TeamCity. http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html
As to excluding the umbraco and umbraco_client folders from SVN; a complex Umbraco build will probably have changes in the Umbraco folder to the default build eg adding Umbraco Event Handlers, adding new Umbraco Sections, changes to back-office tabs. I don't think umbraco_client will change unless you get into changing rich text editors and so on - but it is possible. So I'm not sure that excluding those particular folders is correct. Excluding the media folder is often discussed as well - but it does make TeamCity config simpler if everything is there.
But to answer your question you could exclude them from the build and copy them onto your build server; then add a 'Command Line' runner build step that simply copies them back into place before the build step starts.
I usually add a source control change step that fires a rebuild and have two build steps in TeamCity for an Umbraco project. One is a 'Visual Studio (sln)' runner to check that the sln file has every reference and third party product set up correctly (this should eliminate the 'it works on my machine' issues); and the second is a 'MSBuild' runner that replicates the csproj build process. With the second build step with the right permissions (if your ports are open on the machine you're deploying to, or you're deploying to the same machine as you are on) you could test this in Visual Studio or DOS.
These two build steps should be able to deploy to the IIS website on a staging server; and if the right ports are open on your live or UAT server you could then add a third build step and deploy it onwards (if the first two build steps run properly).

Problem after publishing web application from VS 2010

Whenever I publish my MVC web application in VS 2010 via the One-click publish feature (I'm not doing any web.config transforms or anything fancy - yet!). The next time I come to build the app I get the following error:
It is an error to use a section registered as allowDefinition='MachineToApplication'
beyond application level. This error can be caused by a virtual directory not being
configured as an application in IIS. in ...MyWebApp\obj\release\package\packagetmp
\web.config
A new copy of the web.config file is indeed created by VS2010 below the ...MyWebApp\obj\ folder so I deleted the whole obj folder and I was then able to build again.
But I shouldn't have to do that each time I publish - I must have something configured incorrectly - can anyone help please.
Thanks.
This is unfortunately a known issue with Publishing a web application to the file system. This still affects the release version (RTM) of Visual Studio 2010. It's not limited to the Beta or RC versions.
This problem "bit" me also, and I too was having to manually delete the Debug and Release folders inside the obj folder within my web site solution folder.
The real answer for an automated "workaround" can be found in this answer to the other Stack Overflow question:
Why do I randomly get a “error to use section registered as allowDefinition='MachineToApplication'” when building an MVC project?
In a nutshell, you need to delete the web.config files from either the Debug or Release folders (or both!), and that's achieved with a pre-build command (configured in the Build Events tab of the Project Properties page of your solution):
del "$(ProjectDir)\obj\Debug\Package\PackageTmp\web.config"
del "$(ProjectDir)\obj\Release\Package\PackageTmp\web.config"
Personally, I delete the entire obj folder since all those files are re-created with each build anyway.
I have just found a work around for this that has worked for me, open the .csproj for your web project and change the node under the Project\PropertyGroup node to this:
from this:
<MvcBuildViews>true</MvcBuildViews>
to this:
<MvcBuildViews>false</MvcBuildViews>
This has worked for me, hopefully it will work for you also.

Resources