i want to deploy mvc web site that build with visual studio,to the specific folder location.
how can it done with project post-build event command.
when project build should publish website to the specific folder location.
Two steps:
Create a publishing profile for your project using deploy to file system as a publishing method
On your postbuild event call the msbuild.exe with the DeployOnBuild=true parameter specifying you publishing profile.
I am assuming project is building successfully & has resolved all external references.
1. First set Target Location for a Directory like below image in web project:
this is optional but better than change debug/release from build path again & again.
2. Add something like below in Post-build events:
copy "$(ProjectDir)\bin\*.*" "c:\check\"
Hope it helps.
Update
Is this asp.Net mvc Web project or website? Web project can set output path to bin as in step 1. If you don't want that command in step 2 need path of compiled code as first parameter & path where you need to copy as second parameter, wherever they are. It uses copy command which is as old as DOS & Linux. Refer
https://technet.microsoft.com/en-in/library/bb490886.aspx for copy command.
Related
When I deploy asp.net application through visual studio I know I can just check Precompile during publish and uncheck Allow precompiled site to be updateable.
And I want to do the same with msbuild tool and I am using /p:MvcBuildViews=true /p:EnableUpdateable=false but when I go to IIS and open views they still have their content which means they are not precompiled, right?
They should have line This is a marker file generated by the precompilation tool as they do when publishing from VS. Am I missing something?
Precompile asp.net views with ms build
You should use the arguments /p:PrecompileBeforePublish=true instead of /p:MvcBuildViews=true.
MvcBuildViews is often mistakenly considered as something that when activated results in precompiled views. Actually. It is just a thing to include views to build process but it doesn’t compile these to project binaries folder.
When we check the checkbox Precompile during publish and uncheck the checkbox Allow precompiled site to be updateable on the file publish options, we will get following properties setting in our FolderProfile.pubxml file:
<PropertyGroup>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
</PropertyGroup>
So if you want to do the same with msbuild tool, we should use the arguments:
/p:PrecompileBeforePublish=true;EnableUpdateable=false
Besides, since those arguments are stored in the .pubxml file(under the PublishProfiles in the Properties node in Solution Explorer). They are now designed to be checked in and shared with team members. These files are now MSBuild files and you can customize them if you wish. In order to publish from the command line just pass DeployOnBuild=true and set PublishProfile to the name of the profile:
msbuild.exe "TestPrecompiled.csproj" /p:DeployOnBuild=true /p:PublishProfile=FolderProfile.pubxml
Of course, you can use the arguments and the .pubxml file at the same time, the arguments in the command line will overwrite the property in the .pubxml file:
msbuild.exe "TestPrecompiled.csproj" /p:DeployOnBuild=true /p:PublishProfile=FolderProfile.pubxml /p:PrecompileBeforePublish=true;EnableUpdateable=false
After publish completed, open the .cshtml file in the publish folder, we will get the line This is a marker file generated by the precompilation tool, and should not be deleted! as they do when publishing from VS:
See Precompiling ASP.NET WebForms and MVC Views with MSBuild for some more details.
I am using Jenkins to build my application, which I then need to publish to s3. One of the outputs is an installation exe file that I then provide as a link to users of the application. Because of this I need this installer file to always be in the same place, for every build. However, no matter how I set up my S3 Publishing post-build step the the artifacts are uploaded to a separate folder for every build, like so
Is there a way for me to set up the publish to the root of the directory/bucket every time, overwriting the old file if neccesary? This would eliminate the jobs/TestTrayApp/{buildnumber} directories. This is my s3 publish post-build step setup:
I'm not sure I fully understand what exactly what you want, but based on what I could gather up,you have an .exe file which needs to be in a particular location before publishing to s3 ?
Why not add a another post build action before your actual post build(publishing to s3) copy .exe to the destination location and then initiate publish build.
wont that be easier :)
You simply need another build step that copies the published .exe artifact to the permanent location for users to download.
I think you are confusing "publishing an app to your production environment" and publishing build artifacts. I believe the intent of this Jenkins S3 publish plugin is not to be used for your final release production version but as a build step to archive build artifacts, archive might have the same meaning as publishing in this context regarding your build artifacts. See this article for why I am thinking the Jenkins S3 publish plugin is not meant to be used to actually publish the final release version of your application.
Use a Jenkins Pipeline or add another build step to your Freestyle to copy the exe from S3 build artifact archive to your final permanent storage container for users to download from your website/app.
Unselect both Manage artifacts and Flatten directories checkboxes. And as per the Source give the directory name followed by a / which contains your executable. For example:
This way your latest executable will always be placed in bucket/blahblahblah/executable/executable.exe location no matter how many times your job runs.
I have a C# web application that I have developed using Visual Studio 2010 and commit changes to a VisualSVN repository using the AnkhSVN plugin for Visual Studio.
I have created a Jenkins project that checks the repository every five minutes for new commits and then builds the web application, using the MSBuild plugin, if it sees a change.
This is working fine, however it is building the application to C:\Program Files (x86)\Jenkins\workspace\[Jenkins Project Name]\[Web Application Name] and I would like it to build to D:\Web\[Web Application Name] as this is the directory my IIS site is pointing at. (Both locations are on the same server)
Is there a setting in the Jenkins project where I can change this or do I have to add a build step that copies to a different location using a batch command or something similar?
Many thanks in advance.
You can specify a custom workspace for the Jenkins job to run in.
In your jenkins job look for a button on the right hand side that is labeled Advanced. On Jenkins 2.46.1 it is at the bottom of the General section just before the SCM section of the build job. Click on it and a new set of options will appear, one of them will be Use custom workspace. Check the box and put in the path to the folder you want to use. You should ensure the Jenkins user has permissions on this folder or bad things might happen.
Note that this will perform the entire build in this folder, so anything else that is also in the workspace folder for that build job will be in the new location.
If you want just the output files without all the source and other stuff you will indeed have to add another build step (batch is one option) to copy the relevant files from your build jobs workspace (which can be accessed in batch using the WORKSPACE variable jenkins defines for the job) to the desired destination folder.
I am going to publish a C# windows form application project.
I have a folder named "Reports" Containing some report file.
when I publish the project , my application cannot find the path of reports.
How can I publish my Reports inside the project?
From solution explorer, choose each file that you need to include in the publish and in the properties of the file set Copy to Output Directory to true. This way your files will be included in bin\debug folder of your application in their current folder names.
Then if you want to use Publish command, go to properties of the project, in publish tab, click on Application Files and check Show All Files and change the Publish Status of the files you need to Include.
Pay attention, if your file's Build Action is Embedded Resource then you don't need to do anything else to include in the publish because it's included (embedded) in resources of your application.
I have c# class library that it is a part of a big web site. After build, generated dll file copy to bin folder automatically by post-build event command line:
copy $(TargetPath) "C:\MyWebSite\bin"
My web site run under IIS and I want to debug my class library that its in a separated solution. How can I debug it?
In solution with your DLL which you want to debug, set break point and choose from menu Debug - Attach to Process..., then choose w3wc process with your site pool