ClickOnce - Is there a NoRebuild Property or switch? - msbuild

Is there a way to JUST PUBLISH what is already IN the bin folder to app-publish?
I don't want an entire rebuild, i just want to publish what's there
Microsoft MUST have been smart enough to include some switch to handle this when we are using msbuild.exe to launch a publish?
I don't seem to be able to find one...

It looks like the build starts, but exits if there are no changes, so all is good!

Related

How to copy .exe from output directory on project/solution build automatically in Visual Studio

So looking at this post, VS2010 How to include files in project, to copy them to build output directory automatically during build or publish.
This seems to be pretty close to what I am looking to do, however what I want is to have the .exe that is built be copied to a second output directory.
To help explain, when I build/rebuild my project/solution the .exe's are put in
[somepath]\Projects\[NameOfSolution]\[NameOfProject]\bin\Release\outputFile.exe
What I would like to do is have visual studio automatically make a copy of that outputFile.exe to some other directory, like say a server share on the network that I have read/write access to. The catch is that server share is not always available since I write my code on a traveling laptop. So need to have some sort of logic to check for that I guess...
I truly don't even know where to begin; if it's even possible to do it in Visual Studio. I tried looking into post-build actions in my project settings, but I have no idea what to do in the dialog box. I tried Googling how to do it, but since I don't even know how to explain what I want very well, the google results were useless.
This is in fact a duplicate of Copy file(s) from one project to another using post build event...VS2010
Like I said, I didn't know how to explain what I wanted, so when I searched I didn't find relevant results.
In case anyone comes to this question via a google search in the future, the following Post-Build Event command worked for me (has to all be on one line):
if $(ConfigurationName) == Release copy /B /Y /V "$(TargetPath)" "\\some\path\to\file\share\$(TargetFileName)"

I would like to have my AssemblyVersion in my deployment package name

I am using MSbuild to create a deployment package (simply copying various files from the projects in my solution to different folders) I would like the root folder to be of the format
DeploymentPackage2.3.4.5ForRelease
How can I get MSbuild to put the Assembly number in the folder name automatically?
EDIT:
The solution has a great deal of projects in it (too many really) they all get their version number from a SharedAssemblyInfo.cs file that is manually updated but in the fullness of time will pick up the svn build number (but that is a job for later)
I am building using an external .bat file that calls a custom written .targets/.proj setup that simply calls msbuild on the .sln of the solution.
The 'create package' step I am trying to create happens after a succesful build and will eventually be run by our CI framework, however I would like to be able to run it locally too.
I have created a "CreatePackage" target that does the copying that I want, however it is currently into a fixed folder. I need the folder name to reflect the AssemblyVersion of one of the final dll's.
If there is a better way then I want to know about it... but I am going to use this I think
MSBuild Task to read version of dll

TFS 2010 Build Publish via file system

I've got a fairly large MVC2 project in TFS which gets built automatically on checkin (Continuous Integration)
At present, the fully built version is dumped on a network share on our dev IIS server. \\Server\wwwrootLatest
TFS of course creates lots of sub-folders since it's just doing a build, it isn't even aware that it's drop directory is a wwwroot.
This means that to actually USE the build, we need to go and manually create an IIS App which points at the appropriate directory - which defeats the whole object of the exercise.
When we do a manual publish to that server, we use "File System" as the method and just overwrite the files in the UNC share \\Server\wwwroot
(When publishing to other environments, we use full-on MSDeploy.)
What I'd like to do is convince TFS to do a "File system" publish after the build completes and duplicate what we do on a manual publish eg:
Drop directory is \\Server\Build which would result in something like \\Server\Build\Project\Date.Rev\
After that is complete, we want it to publish to \\Server\wwwrootLatest - we can then set up the App once which will always contain the latest version but will still have a full history if required.
The only examples I've been able to find use MSBuild commands in the build definition (fine) but all use MSDeploy to do a full-on publish. I'm not sure how to automate what I want to do
Any help appreciated.
In your drop folder a folder named _PublishedWebsites is generated automatically. It contains files you need to put in wwwroot. You can use CopyDirectory build activity to copy them automatically.

Delete Itself program

I need to write a program which deletes itself while running...How to do in vb.net and what is the concept to do it..
To have a program literally delete itself without any trace you need to ask at least someone else to delete your (last) executable after it has shut down. This is because a running executable will be in use, and you'd get a sharing violation if you delete it from the code that is running.
You could use Windows for this, I think, using a registry setting of commandlines to run when Windows starts. You could put `delete [full path to your executable]' there. (Google for the correct registry setting if you really need this.)
Another good option seems to be the first link in the reply by Aamir: just before exiting your executable you start another process that uses parts of Windows to wait a bit and then delete your executable.
Yet another option is to make sure you have a correct installer package (e.g. an MSI package) that does what you want using the installer subsystem (e.g. MS Installer) of the OS you're on (e.g. Windows). But this only works if your application has/needs a full installer at all.
It would work like this: when the user uninstalls, let your installer packages make sure the application executable is not currently running. It can show the user that it is and ask to close application before continuing, or it can terminate its process after a confirmation. After this it can delete all files that were installed by the package, including the executable.
In VB.NET/C# in VisualStudio you can use a Custom Installer class to add the "make sure my executable is not running" logic. Or use a third party installer tool to create the installer package that can do this for you automatically.
Probably this can help you:
http://www.codeproject.com/KB/threads/HowToDeleteCurrentProcess.aspx
Another link that seems better
If your goal is to run your EXE and then have it removed sooner-or-later, there are a couple of options:
1) MoveFileEx() API
If you specify the "MOVEFILE_DELAY_UNTIL_REBOOT" flag, and rename from 'your.exe' to '', then Windows will delete it on the next reboot.
2) Schedule a clean-up operation
Using the command-line AT command, SchTasks.exe or the more sophisticated TaskManager API, you can schedule a task to run 'later' which does:
%SYSTEMROOT%\CMD.EXE /C RMDIR /S /Q
You can enable shadow copy in your AppDomain and let the runtime delete the cached copy of your program.
See http://blogs.msdn.com/junfeng/archive/2004/02/09/69919.aspx

Pre-Pre-build Steps in Hudson

I'm in a bit of a pickle. I'm trying to run some environmental scripts before I run the build in a m2 project, but it seems no matter how hard I try - the 'pre' build script are never run early enough.
Before the 'pre-build' scripts are run, the project checks to see if the correct files are in the workspace - files that won't be there until the scripts I've written are executed.
To make them 'pre-build', I'm using the M2 Extra Steps plugin - but's it's not 'pre' enough.
Has anyone got any suggestions as to how I can carry out what I want to do?
Cheers.
Have you considered breaking it up into two projects, and setting the pre-build project to be upstream of the build project?
e.g.,
Foo Pre-build
Foo Build
After Foo Pre-build runs, cause "Foo Build" to run.
I have used this, admittedly in different scenarios than yours, quite successfully. This has the added benefit (if you need it) of allowing you to manually run a build without going through the pre-build steps, if you know they aren't necessary.
You should use the free form project type and not the maven project type.
If this is a problem (ie, there are projects that are expecting to be triggered by or triggering from), consider using a custom workspace location and having a free form project execute in this workspace before the maven project runs. The free form project can be used as the trigger for the maven project.
Does adding another build step as a shell script work?
My problem stemmed from the fact I wanted to set-up my workspace before I ran anything due to an issue with Dynamic Views (ClearCase) not being accessible from the workspace - I wanted to add a symlink to fix this.
However, Andrew Bayer has made a change to the plugin that I'm currently testing that should fix this...so the question is probably invalid in it's current form.
Will edit it once we come to a conclusion.