how can I use dotfuscator for my dlls in web application after build time so when I publish my website it will contain the encrepted dlls instead of the old ones?
Use Post-build event command in VS 2008.
Right click on your csproject, choose properties, go to build event, then inside the post build event command line, type in the following batch command:
dotobfuscator command line, and
the command to copy the files to the website (i.e, copy %encrypteddll% %destination%) .
The copy command should be something like this:
copy "D:\EncriptionFolder\BusinessEntitesLayer.dll" "D:\wefaq\SocialProject\SocialProject\bin\BusinessEntitesLayer.dll"
Or alternatively, you can use NANT or other build tools to automate your build steps.
Related
We're using Visual Studio Team Services with Git as the source control system and I've configured a build which executes successfully online. Ideally I'd like to:
After building the site in VSO, precompile and dump the aspx and .dll files to the git repository
On the on-premises web server, pull from git and move to our staging site
The second part I can figure out on my own, but the documentation for VSTeam seems sketchy on how to dump the compiled sources to git. I've kept the default build configration almost the same as the default with the exception of a Powershell script which is supposed to create artifacts for the drop. Despite this, the drop.zip file create is empty.
The following is how my build definition is set up in VSO.
Instead of the PowerShell script, you'd be able to use the "Copy and Publish artefacts" and have it create a specific artefact with the specific bits you need:
This will automatically create a named build artefact which you can then use from Release Management as an input.
The PowerShell script was used in the XAML builds when used with the "Project Output | As Configured" option.
To create your "packaged" website, you need to add a couple of parameters to the MsBuild/Visual Studio Build step to instrict the compiler to package your website:
/p:DeployOnBuild=true /p:DeployTarget=Package
/p:SkipInvalidConfigurations=true /p:PackageAsSingleFile=false
/p:AspNetCompileMerge=true
Optionally you can configure your target directory as well using
/p:PackageLocation="$(Build.BinariesDirectory)\Published"
If you do this, you need to configure this directory as your copy root in the copy and publish task.
I did a quick look at the Power-Shell script, there are two issues with it:
It still use the variables like "$Env:TF_BUILD_SOURCESDIRECTORY" which does not exist in VSTS(VSO). See Variables for VSTS.
It copies the files from "BUILD_SOURCESDIRECTORY" folder to "BUILD_BINARIESDIRECTORY". But the "Publish Build Artifacts" step in your definition publish the files in "BUILD_ARTIFACTSTAGINGDIRECTORY" folder.
So if you want to use this script, you need to update the script to remove the "TF_" string in the variables and update the "Publish Build Artifacts" step to publish the files in "BUILD_BINARIESDIRECTORY" folder(Set Path to Publish to: $(Build.BinariesDirectory)).
However, if you want to copy and publish the website files, you can simply add one more argument in "MSBuild Arguments" section of "Visual Studio Build" step:
"/p:outdir=$(build.artifactstagingdirectory)"
Remove the Power-Shell script step and the other steps just keep default settings.
Or you can also change the settings of "Copy Files" steps to select the files/folders you'd like to copy.
I'm trying to create a web deploy package using msbuild through command line. I have been searching all over and found the following command
msbuild myproject.csproj /t:package
Though it works for me but it gives me only what visual studio gives us back when we create web deploy package through Packge/Publish Web tab with "only files needed to run this application" option selected from the drop down menu. But I want my web deploy package to look exactly the same as what I get when I select "All files in this project folder" option from the drop down menu. I have gone through links like this http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx.
But I wonder that do I really need to customize my .csproj file (the way its been described in that post) since all I want, is a command line (apparently more elaborate than the one I mentioned above) for msbuild that can imitate the "All files in this project folder" option that populates the "bin folder of web deploy package" with all the .dlls that are there in the original bin folder of my project and generate me a more comprehensive package.
In your commandline simply add /p:FilesToIncludeForPublish=AllFilesInProjectFolder to your msbuild invocation. While you're at it, you may also want to pass in a specific configuration to build /p:Configuration=Release
So:
msbuild myproject.csproj /t:package /p:FilesToIncludeForPublish=AllFilesInProjectFolder /p:Configuration=Release
Tip: Many of these settings are stored in your project file. Open up your file in Notepad and compare the changes made when you have changed some settings. Any item that's in a <propertygroup> can usually be passed along through the commandline as well using the /p: parameter.
I have read articles on build automation and it looks simple, but I am really not sure about parameterized build. I believe, there must be a xml file for that.
When we say build is automated, I believe it means our code/binaries sit in test environemnt. And all application related settings will also configured just by simple clicks of build, and push.
What are the required tools? What is MSBuild ?
Please put some light on it.
MSBuild is and exe that you run with command line tools and pass to it the project file (.csproj) which is an XML file as you said and it has all the instructions needed as you configured.
I created a series of videos that describe how to create simple MSBuild tasks and how to organize tasks and so on, for more info click on the following link:
MSBuild Tutorial
MSBuild is exe
When you run MSBuild from Command line
You will need to unload the projct so you can edit the (.csproj) or project file
The (.csproj) or project file
You are asking about build automation, and by your tags you menation TFS 2010 if so then you only need a cursory understanding of msbuild to get started. It is what eventually calls the compiler, but in all hoensty you need the step above it which are the build templates and defintions, along with how to set up agents and controller.
Here is a good overview document by Martin Woodward, this should give you enough to figure things out, or ask more specific questions
I'd like to offer my .Net library (which I'm developing in the SharpDevelop IDE) as a single dll. I've been manually using ILMerge to merge my compiled library and all its reference libraries together, but would like this done automatically.
I'd ideally like to have this automatic merge happen from within SharpDevelop, without having to set up an external build script. Is this possible?
SharpDevelop uses MSBuild to compile your code so the simplest way would be to create a post build step that runs ILMerge with the correct parameters. You can create a post build step from the Project Options under the Build Events tab. Alternatively you can directly edit your project file in Notepad.
What tool do you use to only zip up the source code of an open souce project or choose which files you want to include for packaging? I'm using Visual Studio 2008.
You can use a version control system like Subversion to do this. All the source files relevant to your project are checked in, and you can create a second working copy in another directory, check if it compiles (i.e. if the source is complete), clean it again, and zip it up minus the .svn directories.
In Visual Studio, use an add-on like AnkhSvn to make sure all files that are in your project are added to Subversion.
You can automate the svn update and zip with any kind of scripting language (msbuild, powershell, perl, python, etc...)
But then, you could also publish the Subversion repository url and let others use that instead of a .zip file!
Are you using a continuous integration process such as CruiseControl.NET? If so you can add a build step to zip up the entire working folder after a successful release build is done and any cleanup is performed, then even save it to an FTP somewhere if needed.
If not you could still do this in the build process from inside Visual Studio by editing the project file in the post build events. Both cases could be done using the MSBuild Community Tasks since there's a Zip task along with FTP and some others.
If you do an SVN Export instead of SVN Checkout, assuming you're using SVN, then the .svn folders won't be created so there shouldn't be any cleanup to perform before zipping up the folder since you'll have an exact copy of your trunk folder.
Ok, I have found 2 ways you can do this
http://www.codinghorror.com/blog/archives/000368.html
or
http://code.google.com/p/treetrim/