.NET Framework Bookmark and Share   
 index > MSBuild > '<projectname>.csproj.user' not handled correctly with WPF projects.
 

'<projectname>.csproj.user' not handled correctly with WPF projects.

With our projects we realy want to set TreatWarningsAsErrors to true, but the project don't all have a fully implmented xml documentation comments added to them so I added a file in the project root named '<the project name>.csproj.user' with the following content. So we have the next couple of months to adjust these problems but stil have a buildable project where no new types of warning can be introduced.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<!-- High warning level, all warnings as errors except #warning and obsolete -->
		<WarningLevel>4</WarningLevel>
		<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
		<WarningsNotAsErrors>618,1030,1701,1702,1591</WarningsNotAsErrors>
		<!-- 
			 618 - Obsolete
			1030 - #warning
			1701 - Assuming assembly reference "Assembly Name #1" matches "Assembly Name #2", you may need to supply runtime policy. (level 2)
			1702 - Assuming assembly reference "Assembly Name #1" matches "Assembly Name #2", you may need to supply runtime policy. (level 3)
			1572 - XML comment on '...' has a param tag for '...', but there is no parameter by that name
			1573 - Parameter '...' has no matching param tag in the XML comment.
			1591 - Missing XML comment for publicly visible type or member.
		-->
	</PropertyGroup>
	<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
		<StartArguments>
		</StartArguments>
	</PropertyGroup>
</Project>

On all 'normal' projects this works fine but on WPF project it's seems to be ignored (or worse, using one for another project). What i noticed was that a WPF project has 2 compilation action, first a '<randomname>.tmp_proj' is compiled and after that the true project is compiled and the compile parameters as defined in the above user file is not used in this tmp_proj compilation.

Am i doing something wrong or is msbuild? Please help.
  • Edited bySvenL Wednesday, September 02, 2009 8:59 AMMarkup changed
  •  
SvenL
Hi SvenL,

Sorry for the delay.

I would suggest you try to add this sentence to your code to test:

<AlwaysCompileMarkupFilesInSeparateDomain>true</AlwaysCompileMarkupFilesInSeparateDomain>.



Beacuse one of the differences between building in VS and command line is that a WPF build in VS defaults to false. And when this value is true, the MarkupCompiler will isolate all assembly loading into a new AppDomain.

Please refer to this bolg for more information:

http://blogs.windowsclient.net/rob_relyea/archive/2009/05/21/why-do-some-wpf-projects-build-differently-in-vs-vs-msbuild.aspx

Please let me know the result.

Thanks,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Marked As Answer bySvenL Monday, September 07, 2009 11:20 AM
  • Unmarked As Answer bySvenL Monday, September 07, 2009 11:39 AM
  •  
Nancy Shao
Thanks Nancy for your reply.

I was a little quick in marking it as the answer.

The problem still exists.

When further examining the output window of VS i can see for WPF project the CSC.exe is called two times.

The first part of the call to the compiler is equal to both calls (show as below)
C:\...\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /doc:..\..\output\Release\lib.XML /define:TRACE /reference:"..." /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\lib.dll

after this the first difference occurs. The second execution of csc.exe has some references to resource files like below plus marking the compilation with the flag warnaserror.
/warnaserror+ /resource:obj\Release\lib.g.resources /resource:obj\Release\lib.....resources (and more)
This is the first part where i think the problem occurs, why is the 'warnaserror+' not present in both compilation steps?

After that all the *.cs file are passed to the csc.exe the same over both the calls to csc.exe.

With finally at the end the last diference, the second compilation step contains '/warnaserror-:618,1030,1570,1572,1573,1574,1591,1701,1702'.

The descibed behaviour occurs both in using msbuild over the commandline aswel when using VisualStudio.

I hope the descibed behaviour makes sense :)

Kind regards,
Sven
SvenL
Hi Sven,

I don't understood clearly. Do you mean runningWPF projects has two different results by Visual Studio IDE and MSBuild? Have you run other kind of projects?

Have you resolved the first questionaboutWPF porject be ignored?


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Nancy Shao

You can use google to search for other answers

Custom Search

More Threads

• How do you create & deploy ASP.Net web application to DFS in cluster environment?
• Strange problem with dependencies
• Forece refenced dll to be copied for a project reference
• How can I know if it's a release or debug build?
• Way to avoid repeating targets
• tasks I would like to see added to MSBuild
• how to know when a build fails
• Is it possible to build a sln file without having VIS 2008 installed on that machine?
• Missing specified module when validating website
• Custom task fails to populate property with empty string