Modify .csproj in pre-build event - visual-studio-2012

tl;dr: How to modify the .csproj file during publishing with ClickOnce while executing pre-build events?
Long:
I'm using TFS hosted by Microsoft for version control of my solution.
When publishing with ClickOnce, I get the latest revision number + 1 without problems. I also can successfully write the new version number into the .csproj file outside my build-process.
The problem is, that the .csproj file doesn't get updated during the build process - it might be in a write-lock. I get a notification inside Notepad++ about the modification of the file, but the file still contains the old version and VS didn't notice any changes.
The only solution by now I found to resolve this issue:
Move the revision update into the post-build events and add 2 instead of one to the actual revision number. Unfortunately this would cause that revision number would be out of date whenever other developers check-in code.

Ok, strike that... :(.
After some more diffing, you'll need to override the GenerateApplicationManifest target to get this to work. That target doesn't use a *DependsUpon propertygroup, so it's harder to overwrite. The whole flow is defined in the Microsoft.Common.Targets file which you can find in the %windir%\Microsoft.NET\Framework{cpu}\{version} folder.
See also:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/3a94df52-74c1-4fca-a830-ab530ec49207/use-msbuild-to-create-clickonce-app-files-in-alternate-location

Related

Get specific Version from Source control

I have 34 word templates in TFS and I'm suing VS2012.
Only 32 have been modified and saved under a change set.
I wanted to just extract those modified by that change set.
I made sure my mapped folder was empty before I started.
I used Advanced/Get Specific and then did a get using the changeset number
However, all 34 templates were downloaded into my folder.
The changeset get seems to get all files modified before and up to the change set I requested.
In my case I can pick out the 2 files and remove them. But if I had hundreds of files spread over a dozen folder it would be a nightmare.
Is there a way to get only those files modified by a specific changeset files ?
"Get Specific" means getting all the files as how they were at the time when ChangeSet was created. It doesn't mean getting only changed files.
Since you are using VS 2012, you could use Team Foundation Power Tools' tfpt GetCS command:
The GetCS tool retrieves all items listed in a changeset for a
given changeset version.
This is useful when a co-worker checks in a change that you need to
have in your workspace, but you cannot upgrade your entire workspace
to the latest version. Use the GetCS tool to get just the items
affected by your co-worker’s changeset. You can do this without
inspecting the changeset to manually list the changed files when using
a getcs command.
There is no graphical user interface for the GetCS tool. To invoke
the GetCS, type the following command. The parameter
changesetnum specifies the changeset number.
tfpt GetCS /changeset:changesetnum

How to auto Archive by version history

I want to put the files from Document library A into another document library called Archive. I have to version history enabled, limited to 10. when a new file gets added in, the older files get deleted. How can I move them to another document library called Archive. How can I achieve this? Please advise.
Using MS Flow you can build a simple workflow that will copy a file from one library to another one. The workflow can be triggered upon file add (list item) event. Everything can be done in MS Flow browser designer. When adding file to archive library you need to change its file name (e.g. add time stamp) so you will not overwrite existing file in archive library.

TFS cannot rollback: "The item being rolled back has changed in a later version"

The Scenario
I want to rollback a changeset.
The Problem
When I perform Rollback Entire Changeset from my $/SAM/Main branch using the VS2012 IDE, the Resolve Conflicts tab displays, and ALL of the files I'm trying to rollback have the following message associated with them:
The item being rolled back has changed in a later version
Changes being rolled back: 54460~54460 Your workspace version is: 54460
You have a pending change on the item
At this point, the only option available to me in the Resolve Conflicts tab is an Undo Rollback button.
Things to Note
CS54460 was created using the following command line:
merge $/SAM/Dev $/SAM/Main /discard /recursive /version:C54426~C54426
CS54460, when viewing the Changeset Details, performs a [merge, branch, delete] on ALL the files.
Why I Need to Do This
I need to do this, because I need to merge CS54426 from the $/SAM/Dev branch up to the $/SAM/Main branch.
Don't use rollback, just do it manually:
get the version you want to roll back to
back up the changed files
check out the changed files. If you're lucky the old code will be preserved but the checkout may force you back to the newest version.
so if necessary copy the backups over the master source files again
test and check in
My problem was solved by using the following command:
merge $/SAM/Dev $/SAM/Main /recursive **/force** /version:C54426~C54426
This forced the changeset I needed in $/SAM/Dev to disregard the "Keep Yours" changeset in $/SAM/Main, thus merging the code I needed up to the $/SAM/Main branch.
I was getting the error "TF203051: Cannot rollback item XYZ because the workspace version of the item is at or older than the version to which you are trying to rollback to. Update the version in your workspace to a newer version than the version to which you are trying to rollback to and then retry your operation." when attempting to roll back to a specific version in the history in VS2017.
The problem was that file XYZ, one of the files was included in multiple changesets, a second one was more recent than the one I was trying to roll back.
Luckily I needed to roll back that too. So the solution was to roll back both versions at the same time by selecting them together in the history view of Source Control Explorer.

TFS2010 Branching vcxproj not updating SccProjectName

So, I've got a native vc++ application that we currently have stored in TFS2010 (no SP), and we have finnally gotten to the point after the migration from TFS2005 to TFS2010 where we need to branch the code...
After branching the code, which now in TFS2010 does everything on the server and no longer leaves all of the files checked out on the client machine, and which also did NOT throw any errors of any sort... if we try to open the branch copy of the application we get an error:
"There appears to be a discrepancy between the solution's source control information about some project(s) and the information in the project's files(s). ... blah blah blah"
Now this error is being thrown because inside the project file (vcxproj) the SccProjectName value was not updated as part of the branching, so it is still pointing to full path of the trunk source location. Although when it throws this error it will prompt for a check-out and will update the value to the correct value... but it's will be annoying for it to happen every time we branch and there's no way to change it before it throws the error.
Online in various places the 'solution' (I use this term loosely because it doesn't work...) is to change the SccProjectName to "SAK" so that it will use the value in the mssccprj.scc hint file, however the TFS plugin doesn't use a mssccprj.scc hint file... so it will continue to throw the error...
So is there another solution to this issue? or does anybody know if the TFS2010 SP1 fixes this issue?
I had the exact same problem when moving code around in TFS 2010. Here is the solution that I found to work:
It is easier to do this by selecting the solution in Solution Explorer, going to File -> Source Control -> Change Source Control and then unbinding everything. Close the dialog, then re-open it and rebind everything. Save the changes and compare the VCXPROJ files now. The server path and the rest of the TFS info has been removed and replaced with SAK.
Source: http://social.msdn.microsoft.com/Forums/en-US/tfsversioncontrol/thread/786d7d3e-5182-4452-b49b-3436de6f9c36/

Merge Module not found. Installshield 8

We're using Installshield 8 in creating our installer.
While building, we are getting this error.
Error -4075: File not found.
We traced the problem to a "missing" Merge Module. The weird thing is, the Merge Module does exist in the correct location! Browsing the merge module manually solved the problem. So we checked-in the fixed ISM file, restored the build machine (We had it snapshot'd), fetched the entire tree and built from there. Still, the merge module problem is there.
I noticed that when you browsed for the "missing" Merge Module, the problem will no longer exist even if you did not save the ISM file.
Have anyone experienced this problem?
Thanks.
UPDATE:
Our Merge Module is not located in the Default Location for Merge Modules where Installshield is looking. In the newer version of IIS, there is a -O flag for IsCmdBld.exe which allows you to specify additional locations for your custom merge modules. One option that we have is to just copy our merge module to one of those Default Locations. But if someone can have a "neater" solution, please. :)
If you click on Tools/Options/Merge Modules you can specify the directories in which you want the IDE to search for merge modules; in other words, expand the number of "default" locations where IS will search.*
For command-line building, you are correct; you have to use the "-o" switch.
*Disclaimer: this holds true for modern versions of InstallShield (last 5 years). I assume IS8 is the same, but YMMV.

Resources