views:

169

answers:

1

We have a codebase built using Visual Studio 2008 that contains resource files (SR.resx). Some tool will create a file named "SR.Designer.cs" from SR.resx and VS2008 adds it to source control. All is well when first created. Things go badly when a second developer checks out the sources on his machine.

We use Perforce, which checks out files read-only.

If the second developer is starting from scratch, the first build generally fails with the message "Cannot write to the Strongly Typed Resource class file "SR.Designer.cs". We need to set all the files to read-write in order to do the build. This despite the fact that the SR.Designer.cs files are not changed (checked via "diff" after the build).

This also plays havoc with our build server, where we'd like to do the build starting from an empty directory, pull the sources and build.

How do folks deal with this situation?

The generated code contains:

/// <summary>
///   A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.

Can I configure StronglyTypedResourceBuilder in any way?

A: 

Change the file attributes of the files in question to +w (always writable in workspace). On the command line, you can do this with

p4 reopen -t +w <file>

You can also do this in P4V with Actions -> Change Filetype.

obiltschnig
Thanks, this does the trick. The only reservation I have is a niggling doubt that the build produces the same .cs file each time. I guess I can either figure out the rules StrongTypeResourceBuilder follows; or I can add a script to diff each .cs file with the one in perforce.
Steve Robbins