I've created service using ASP.Net MVC5 and I want that TFS building would create publish folder for the project. How can I do that?
You have to add in the build definition the /p:DeployOnBuild=true;DeployTarget=Package values in "MSBuild arguments" parameter.
Related
There is a Visual Studio solution that has multiple web application projects. All of them are to be published to a common folder - D:\inetpub\wwwroot\FirstSite.
Each project has a publish profile Local.pubxml which imports settings from a global publishsettings.xml, and I use the One-Click Publish feature to publish each project.
Now, I would like to automate this process, which will Rebuild the solution and on success, publish all the projects to the target folder.
I have managed to create a Console application using C#, which can build all the projects in a solution. But, unfortunately could only go that far, as I'm unable to figure out how to get started about the publishing.
I'm not looking for setting up a build server. Just want to save time publishing projects to local folders.
Can we achieve this in a console application, by passing parameters like 'solution path' & 'target folder path', so that it can work for any such solution with multiple projects.
If not, are there any simple tools for this.
When you invoke msbuild for the solution build, you can pass
/p:DeployOnBuild=true /p:PublishProfile=Local /p:SkipInvalidConfigurations=true
which will publish each project with the Local profile for you
I am using Team City to deploy an ASP.NET Website.My Issue is Artifact folder contains .cs and designer files too. How to remove these type of files from Artifact folder. For ASP.NET websites we do not need such files.Need files like ASCX,ASPX,JS,CSS etc only.
Using Publish Profiles and Web Deploy to generate a deployment package, you can specify that only files required to run the application are captured as artifacts in TeamCity.
Update Visual Studio Project Properties:
Choose "Only files needed to run this application" in the Package/Publish Web section
Create a Visual Studio Publish Profile:
Set Web Deploy as the Publish Method
Update TeamCity Build Runner: Add /p:PublishProfile="[name of publish profile created in previous step]" to the Command Line Parameters
Update TeamCity Artifact Path: [your source path]\obj\[VS build configuration]\Package\** => artifacts\[your desired path and file name].zip
Unfortunately I can't add any more screenshots due to rep. Hope this helps!
So maybe I'm a little bit confused about how a nuget server works and the specifics of nugets in general.
I am setting up octopus deploy and TeamCity for my company and have run into a bit of a snag. I am trying to set up a deployment where I deploy a website and a service in the same release, however, Octopus can't seem to find the nuget package. It throws the following error:
Could not find any packages with ID 'PackageName' in the feed 'octopus://'
I am able to see the package when I test the feed in octopus, and I verified that I am using the correct ID in teamcity. Basically what I've been trying to research is how I can view all of my nugets in the feed. Is that a thing? I am using TeamCity as the Nuget server and I know with octopus you can view all packages that have been pushed to its repository. Am I able to view all packages in the TeamCity Nuget server? I want to verify that my package is there.
In order for Octopus to be able to publish the package, it needs it to be set to build an OctoPack.
To get this working, use the NuGet package manager for the project in question and add a reference to 'OctoPack'.
Bear in mind that if you have a Visual Studio solution containing several packages and you want several of these to be deployable packages you will have to add OctoPack to each project you want as a deployable package.
Include Octopack in the project to build the nuget package.
Use this parameter with MSBuild to automatically push the package to the destination nuget gallery after the build is complete.
/p:OctoPackPublishPackageToHttp=http://my-nuget-server/api/v2/package
I have created a VS build definition on Team Services. The build runs successfully when I queue it and it also outputs the dlls for all the projects in the solution except the service layer which I have created using Web Api2.
when I download the artifacts from the drop location, I have folders holding the dlls for the data layer, the business layer and other helper projects. What I don't have is the main service layer dll which I can deploy to my IIS.
Here is a screenshot of my publish settings.
What could I be missing ?
It seems that you are using the default settings for the build definition. With these settings, the contents for "Copy Files" task is "**\bin\$(BuildConfiguration)**" while web api project does not have buildconfiguration folder. So it cannot find the files for web api project. To copy these files, add one more "Copy Files" task and configure the settings as following:
If you want the deployment files for the project, you need to set you build definition as following:
Add arguments /p:DeployOnBuild=true;OutDir="$(build.artifactstagingdirectory)" for Visual Studio Build step.
Remove Copy Files step.
Set Path to Publish to $(build.artifactstagingdirectory)\\_PublishedWebsites for Publish Build Artifacts step.
Then you should get the deployment files in the drop folder.
Open the Configuration Manager in VisualStudio and ensure the WebAPI project is included for the configuration (Debug, Release, etc) that you are building.
In my Visual Studio Project we are using 2 Different Membership Providers we would like by build configuration type to have the selected project added to the Web Project
MyApplication.Provider - DEBUG - (SQL Membership Provider)
MyApplication.Provider.AD - RELEASE - (AD Membership Provider)
MyApplication.Web (ASP.NET MVC Project)
When we are debugging locally on our machine I want the project to use project reference for the MyApplication.Provider and when creating a release project I want to load the MyApplication.Provider.AD
In both projects I made the public classes use the matching namespaces.
In the build configuration for each configuration I excluded the Project not utilized
For the Web.config differences in the Post Build Option I can successfully add the correct Web.config File.
The Issue is that when I build the solution I cannot get the correct project DLL added to the Web Project.
What is the Best practice way to handle this, Do I need to modify the web project .csproj with a MSBuild Command or are there other project settings I need to configure to handle this.