Showing posts with label MSBuild. Show all posts
Showing posts with label MSBuild. Show all posts

Thursday, January 21, 2010

WPF project building inside of Visual Studio but not with MSBuild/TFSBuild

At work, I recently run into a strange build error when building from MSBuild and TFSBuild while the same solution built inside of Visual Studio 2008 just fine.

The error message was:

error MC3015: The attached property '?' is not defined on '?' or one of its base classes.

(obviously with real names instead of the questionmarks)

Feeding the above into google provided the following solution to the issue:

One of the differences between building in VS and command line is that a WPF build in VS defaults to

<AlwaysCompileMarkupFilesInSeparateDomain>true</AlwaysCompileMarkupFilesInSeparateDomain>.
Outside of VS, the default is false.

(Answer by Rob Relyea)

Adding that to the relevant .csproj made the project build successfully.

Tuesday, May 08, 2007

Different signing options depending on configuration


There was a question in the MSBuild newsgroup about the possibility to have different signing settings depending on configuration.


Basically, let's pretend pretend that what we want is the following:



  • Debug: Delay sign using PublicKey.pk

  • Release: Sign using KeyPair.pfx



From within Visual Studio it seems impossible, due to the fact that the configuration boxes are grayed out. All is not lost though, by moving the code signing options into the appropriate configurations (by directly editing the project file).


Debug:


<PropertyGroupCondition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">


<snip/>


<SignAssembly>true</SignAssembly>


<DelaySign> true</DelaySign>


<AssemblyOriginatorKeyFile>PublicKey.pk</AssemblyOriginatorKeyFile>


</PropertyGroup>


Release:


<PropertyGroupCondition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">


<snip/>


<SignAssembly>true</SignAssembly>


<AssemblyOriginatorKeyFile>PrivateKey.pfx</AssemblyOriginatorKeyFile>


</PropertyGroup>


And there you go!


(The obvious? drawback with this method is that the signing behavior isn't directly visible from within the Visual Studio project properties.)




Technorati : ,

Monday, May 07, 2007

Editing a Visual Studio 2005 project file


[This is not really news, just wanted to publish it somewhere so I can refer to it]


So how do you do it then?


It is simple actually:




  • (If the project file is under a locking source control provider e.g. Microsoft SourceSafe, you probably want to check out the project file first, as Visual Studio isn't smart enough to do it for you when you edit the file directly.)

  • Right-click a project in the solution explorer

  • Choose "Unload project"

  • Right-click the same project, that now is grayed out and suffixed with (unavailable)

  • Choose "Edit <filename>"

  • Edit away ...

  • Right-click the project, still suffixed with (unavailable)

  • Choose "Reload project"


There you go!


Caveat: This doesn't work under the Express versions of Visual Studio. That is, the "Unload Project" menu item is absent, you can still use the editor with schema support.




Technorati : ,