My web site is a checkouted version of SVN repo. I mean .svn folders are placed on web server. I don't use web publishing.
And I want to display current project revision (whole web site) in footer. How can I do that?
If I were using web publishing, I could determine revision on build/publish and write it as static html.
So how to get revision dynamically? Read .svn files directly? Are there better ways?
I saw other such questions, but answer was using SubWCRev.exe, it isn't unfortunately acceptable.
Edit: Tarn gave interesting idea about SVN hooks on commit. Any other ideas?
use keyword substitution. enable substitution for the files you want to display revision information, and put a keyword, like $Revision: 144 $, there.
note that
$Rev$ expands to show the last
revision in which the file changed,
not the last revision to which it was
updated
(see link above). if you want to show the global repository revision number, you better use svnversion.
also, see Related.
You can write hooks for SVN. You could write a hook to update a file with the current build as part of your checkout process. Then you can read, cache and display that build number on your site.
This previous question on SO has some discussion that might be useful to you: Always Commit the same file with SVN.
I've always done it by running a script that would use sed to replace a comment with the current timestamp in my $Rev$ file. That way, the file contents would change and Subversion would commit it. Somewhat manual, but you could write a script to first do that, and then do the actual svn commit command.
If want to display the latest revision number of your entire/repository or branch, keyword substitution will not help, I think a better solution would be to use a Build Management/Continuous Integration software, like CruiseControl.NET or TeamCity with a good build script.
Duplicate of:
How do I sync the SVN revision number with my ASP.NET web site?
ASP.NET Display SVN Revision Number
The only thing I can think of is to use the svn CLI binaries and call them from the page. That way you can strip out the rest and grab the revision number. To be honest though, its a somewhat ugly solution.
Related
When I bundle a script like so:
bundles.Add(new ScriptBundle("~/bundles/Product/Details").Include(
"~/Scripts/external/XXXXConfig-{version}.js",
"~/Scripts/external/Views/Product/ProductFavorite-{version}.js"));
My expectation is that if there were two files in that directory:
XXXXConfig-1.0.0.js
XXXXConfig-1.0.1.js
That it would only include the latest version, i.e., XXXXConfig-1.0.1.js. Instead it is bundling BOTH together, which causes the system to fail spectacularly.
My expectation comes from here, and other sources. Is this expectation wrong? In any case, is there some way to make it so that it ONLY includes the latest version?
Yes, your expectation is incorrect. The {version} wildcard is used as a placeholder for any version, not the latest. It allows it to update your NuGet package without having to change your bundling code every time.
The only smart thing that the {version} wildcard does is that it select the file with min (if it exists) for release and with no min for debug. Other than that, it's just a wildcard like any other.
I'm not aware of any built-in feature that selects the latest release for you. You'll have to program it by yourself if you want that. You can search to see if someone has already done such a thing. But I wonder why you want more than one version to exist in your folder.
Edit: To elaborate on the min feature as your requested, I think the MSDN that you linked to described well, but here is an example:
Let say your folder has two files SEMSConfig-1.0.0.js and SEMSConfig-1.0.0.min.js. When you run your project in debug mode, the file SEMSConfig-1.0.0.js will be used. When you run your project in release mode (or publish it), the file SEMSConfig-1.0.0.min.js will be used.
I'm using Artifactory Pro with custom repository layouts. I promote my build and move all artifacts to my production repo. But I need to add an article number in this path, so the guys can reference it to their ERP System.
I tried some stuff here, with promoting and moving artifacts to match their needs. It works, but its not nice.
So I added my custom layouts:
For my developement repo:
[org]/[module] ...etc...
For my production repo:
[Articlenr<.*>]/[org]/[module] ...etc...
When I promote my build, my files are stored like this
[Articlenr]/customer/linux ...etc...
The article number is just filled up with [Articlenr], but I'm not able to replace it by the real one, without moving the complete directory.
Anyone here knowing, how to set the article number while promoting this build?
My builds are promoted by JFrog CLI, but using the Artifactory REST API is an option, too.
Thanks a lot!
Currently, there's no way to use the promote command to promote a build with a target path as an argument.
If you are not set on using promotion, consider using the CLI's COPY or MOVE commands, where you can use placeholders in the target path to increment your Articlenr.
The downside of using cp/mv instead of bpr would be the fact that your build will not be flagged as promoted in artifactory (build-info), which may be a problem in some cases (like if you are using build retention for example).
It is not an ideal solution, but it might suffice for what you are trying to accomplish.
HTH, Or
Is it possible to include the revision number or the name of the tag used for a build on an ASP.NET website when deploying with CruiseControl.net and subversion?
You can use SubWCRev for this. By integrating it into your build script, you can do keyword replacement in your source, replacing with things like the current revision number.
You can also make use of the svn:keywords property for this. The svn:keywords property works on a file-by-file basis, though, and thus expands to the last revision of the file, as opposed to the last revision of the repository as a whole.
Is it possible to exclude a folder in a web project from being published? We've got some documentation and scripts that included in a particular project folder, and are added to the project, but when I do a VS publish, I don't want them to go up to the production server.
I know they shouldn't be in the project, but I thought I'd find a workaround before I try to convince the owner to modify the way he's doing things.
Old question, but I found if I mark the folder as hidden in Windows Explorer, it doesn't show/publish in your solution.
This is good for example to stop original photoshop images being included in uploads which aren't used and are big. Anything more complex though you'll probably want to write your own publish tool.
This doesn't answer your question, exactly, but my feeling is that unless you are a single developer publishing to a server, you would be better off doing builds on a dedicated workstation or server using MSBuild (or some other building and deploying solution) directly (and thereby would be able to very granularly control what goes up to production). MSBuild can not only build, but using some extensions (including open source types), it can also deploy. Microsoft has a product called MSDeploy in beta, and that might be an even better choice, but having no experience with it, I cannot say for certain.
In our situation, we have a virtual workstation as a build box, and all we have to do is double click on the batch file that starts up an MSBuild project. It labels all code using VSS, gets latest version, builds the solution, and then deploys it to both servers. We deploy exactly what we want to deploy and nothing more. We're quite happy with it.
The only downside, if it could be considered a downside, is that at least one of us had to learn how to use MSBuild. VS itself uses MSBuild.
For the files you don't want to go, loop at the properties and set the 'Copy to Output Directory' to 'Do not copy'
This option is not available for directories, however.
Can you not exclude them from the project through visual studio to stop them being published. They will the still exist in the filesystem
The only way that you can do this to my knowledge would be to exclude it from the project, do the publish, then re-include it in the project. That can be an issue.
There are probably much better ways to solve this problem but when we publish a build for our dev servers, we'll run a batch file when the build is complete to remove the un-needed folders and web.configs (so we don't override the ones that are already deployed).
According to http://www.mahingupta.com/mahingupta/blog/post/2009/12/04/AspNet-website-Exclude-folder-from-compilation.aspx you can just give the folder the "hidden" attribute in windows explorer and it won't publish. I tested this and it works for me.
Seems like a straightforward solution for quick and dirty purposes, but I don't think it will carry through our version control (mercurial).
Select all the files that should not be published.
Go to Properties
Set
Build Action -> None
Have to repeat the process for each sub-directory.
I'm trying to make a setup program for an ASP.NET web site. I need to make sure the target machine has sqlxml installed.
I must verify the target machine has the software installed, and if not, launch a .msi file either before or after the main installation.
I'm a complete newbie with setup projects, so maybe this is obvious, but after several hours browsing the web I haven't found a satisfactory solution. I've been reading about WiX, etc. but I'm looking (if possible) for a simple solution.
Thank you both!
I understand an installer can't run another one. I was thinking in a functionality similar to Prerequisites (in project properties). There I can check a component and it will be automatically installed if it isn't. I don't need to do anything else. But, the most important thing for me is that the installation won't run if it's not needed.
I also tried the .msm solution, but I couldn't find any. Maybe I can make one myself? I haven't tried it yet though.
Unfortunately, you can't run one installer from another, since only one can be running at a time. You need to chain them together and run one after the other. Google "msi chaining". This is often the reason why products like Visual Studio use an external setup.exe which then runs the installers one after the other.
Looks like you need to 'chain' the installs http://objectmix.com/xml-soap/84668-installing-sqlxml-net-app.html
You can get the redist here http://www.microsoft.com/downloads/details.aspx?FamilyID=51D4A154-8E23-47D2-A033-764259CFB53B&displaylang=en
CAn you add this as a pre-req for your install?
What are you using to build the create the install?
Edit:
I had a look to see how you can check of the SQLXML is installed and come across this:
http://www.tech-archive.net/Archive/SQL-Server/microsoft.public.sqlserver.xml/2005-04/msg00110.html
The system I am on just now has the following key HKEY_CLASSES_ROOT \ SQLXMLX (note the X at the end), so you might need to do a bit more investigation in to what the actual key is.
I'm not familer with Visual Studio install authoring but if you can add an entry to the AppSearch and RegLocator tables you should be able to check for the existance of the registry key when the install starts. See here
http://msdn.microsoft.com/en-us/library/aa371564(VS.85).aspx
The Reglocator table gives you the option to set a property with a value from the registry if found. You can then use this in the condition on a custom action.
A lot to put together, but I hope it move you in the right direction.
Brent's answer is correct. I would just add that, sometimes, you can find a "merge module" for the bits you depend on. That's a .msm file. You can certainly include 1 or more of those in your .msi file. I have no idea whether a merge module is available for SQLXML. Sorry.