Hi everyone, my team is using a webdeployment project and we have a project reference which is a code library (so it is not a web project). I was able to raise the warning level and TreatWarningsAsErrors for the web project by adding the following entries
in the web.config file.
Can you please point me to the right direction on how to achive this. I tried adding following elements to the <PropertyGroup> but did not work for me. Since web project is getting compiled with aspnet_compiler.exe I was wondering referenced project will
be compiled with csc.exe since it is NOT a web project.
Any insight on how to achive this will be greatly appriciated.
<!--Sets the appropriate warning level, from 0-4 -->
<WarningLevel>4</WarningLevel>
<!--Optional Boolean parameter.If true, treats all warnings as errors.-->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
VS 2005 Web Deployment ProjectsVisual Studio 2005 Web Deployment ProjectsVS 2005 Web Deployment ProjectWeb Deployment Projectmsbuildweb deployment projects
In Visual Studio, when you right click on a class library project and choose "Properties", you will see a "Build" tab where you can set the warning level and to specify treat warning as errors.
Are you not able to do that for your referenced project?
==============================================
If you get the answer to your question, please mark it as the answer.
What kind of project is this "referenced project" you are referring to? And how are its compilation settings related to the web deployment project?
I don't fully understand what you are trying to achieve. You have three projects in your solution if I understand correctly: Web site, Web deployment project, Referenced project.
You mentioned you get warnings as errors for the web site. Are you trying to get warnings as errors for the referenced project? If so, why is it not possible to just set that setting in the referenced project?
==============================================
If you get the answer to your question, please mark it as the answer.
Thank you for you interest and sorry for the confusion.
I am using msbuild which inturn calls webdeploy.wdproj for compiling a website which has a reference to a Class Library. And webdeploy.wdproj is not included in my solution file. (My solution has 11 websites and a class library but with help of msbuild
I am able to use just one webdeployment project file and call it multiple times from msbuild)
What I am trying to achieve is: I don't want to modify project file for the class library, and I want to be able to use
<WarningLevel><TreatWarningsAsErrors> elements in the webdeployment project file.
This sounds more like a msbuild question, perhaps you might also want to try the msbuild forums. I am not sure if it is specific to web deployment projects, since the main question seems to be how to set certain properties to be passed to the actual project
specified in ProjectReference?
==============================================
If you get the answer to your question, please mark it as the answer.
Thanks you for your advise. I will try msbuil forums. For now I modified the project file for the class library and web.config file for the web project and it is working fine.
Utkan Celik
0 Points
5 Posts
How to TreatWarningsAsErrors on a <ProjectReference>
Apr 03, 2008 03:12 PM|LINK
Hi everyone, my team is using a webdeployment project and we have a project reference which is a code library (so it is not a web project). I was able to raise the warning level and TreatWarningsAsErrors for the web project by adding the following entries in the web.config file.
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp"
extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider, System,Version=2.0.3600.0, Culture=neutral,PublicKeyToken=b77a5c561934e089"
compilerOptions="/warnaserror"
warningLevel="4"
/>
</compilers>
</system.codedom>
I would like to do the same thing for the project we are referencing
<ItemGroup>
<ProjectReference Include="$(SourcePath)\Files\BusinessLogic\Package.csproj">
<Project>{25077010-5335-4BDE-8E3F-6CFC1F867CE3}</Project>
<Name>Some namespace...</Name>
</ProjectReference>
</ItemGroup>
Can you please point me to the right direction on how to achive this. I tried adding following elements to the <PropertyGroup> but did not work for me. Since web project is getting compiled with aspnet_compiler.exe I was wondering referenced project will be compiled with csc.exe since it is NOT a web project.
Any insight on how to achive this will be greatly appriciated.
<PropertyGroup>
<SourceWebPhysicalPath>$(SourcePath)\Files\$(SiteName)</SourceWebPhysicalPath>
<SourceWebVirtualPath>/localhost_$(SiteName)</SourceWebVirtualPath>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputPath>$(Builds)\Builds\$(SiteName)</OutputPath>
<!--Sets the appropriate warning level, from 0-4 -->
<WarningLevel>4</WarningLevel>
<!--Optional Boolean parameter.If true, treats all warnings as errors.-->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
VS 2005 Web Deployment Projects Visual Studio 2005 Web Deployment Projects VS 2005 Web Deployment Project Web Deployment Project msbuild web deployment projects
hongping
Contributor
3403 Points
635 Posts
Microsoft
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 03, 2008 07:46 PM|LINK
In Visual Studio, when you right click on a class library project and choose "Properties", you will see a "Build" tab where you can set the warning level and to specify treat warning as errors.
Are you not able to do that for your referenced project?
If you get the answer to your question, please mark it as the answer.
Utkan Celik
0 Points
5 Posts
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 03, 2008 08:20 PM|LINK
I am able to do that from Visual Studio, but I want to do that from a webdeployment project by using (or passing ) compiler switches.
Something like this
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.targets" />
<PropertyGroup>
<EnableUpdateable>true</EnableUpdateable>
<UseMerge>false</UseMerge>
<SingleAssemblyName></SingleAssemblyName>
<UseFixedNames>true</UseFixedNames>
<UseWebConfigReplacement>false</UseWebConfigReplacement>
<ValidateWebConfigReplacement>true</ValidateWebConfigReplacement>
<UseExernalWebConfigReplacementFile>true</UseExernalWebConfigReplacementFile>
<EnvironmentToBuild>QA</EnvironmentToBuild>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(SourcePath)\Files\BusinessLogic\BusinessPackage.csproj">
<Project>{25077010-5335-4BDE-8E3F-6CFC1F867CE3}</Project>
<Name>BusinessPackage</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets" />
........ more targets and properties.
hongping
Contributor
3403 Points
635 Posts
Microsoft
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 03, 2008 08:27 PM|LINK
What kind of project is this "referenced project" you are referring to? And how are its compilation settings related to the web deployment project?
I don't fully understand what you are trying to achieve. You have three projects in your solution if I understand correctly: Web site, Web deployment project, Referenced project.
You mentioned you get warnings as errors for the web site. Are you trying to get warnings as errors for the referenced project? If so, why is it not possible to just set that setting in the referenced project?
If you get the answer to your question, please mark it as the answer.
Utkan Celik
0 Points
5 Posts
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 03, 2008 08:45 PM|LINK
Thank you for you interest and sorry for the confusion.
I am using msbuild which inturn calls webdeploy.wdproj for compiling a website which has a reference to a Class Library. And webdeploy.wdproj is not included in my solution file. (My solution has 11 websites and a class library but with help of msbuild I am able to use just one webdeployment project file and call it multiple times from msbuild)
What I am trying to achieve is: I don't want to modify project file for the class library, and I want to be able to use
<WarningLevel><TreatWarningsAsErrors> elements in the webdeployment project file.
hongping
Contributor
3403 Points
635 Posts
Microsoft
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 03, 2008 08:53 PM|LINK
Do you mean that when you are compiling the individual class library, you do not want treatWarningsAsErrors for this class library?
And that you only want treatWarningAsErrors for the class library when you are building webdeploy.wdproj?
If you get the answer to your question, please mark it as the answer.
Utkan Celik
0 Points
5 Posts
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 04, 2008 01:52 PM|LINK
Correct.
hongping
Contributor
3403 Points
635 Posts
Microsoft
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 04, 2008 06:20 PM|LINK
Thank you for the clarification.
This sounds more like a msbuild question, perhaps you might also want to try the msbuild forums. I am not sure if it is specific to web deployment projects, since the main question seems to be how to set certain properties to be passed to the actual project specified in ProjectReference?
If you get the answer to your question, please mark it as the answer.
Utkan Celik
0 Points
5 Posts
Re: How to TreatWarningsAsErrors on a <ProjectReference>
Apr 07, 2008 12:31 PM|LINK
Thanks you for your advise. I will try msbuil forums. For now I modified the project file for the class library and web.config file for the web project and it is working fine.