Groups | Blog | Home
all groups > visual studio .net general > november 2006 >

visual studio .net general : msbuild aspnetcompiler task -keyfile?


David Thielen
11/21/2006 10:06:01 AM
Hi;

For the task aspnetcompiler in msbuild how do I pass the -keyfile parameter?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

stcheng NO[at]SPAM online.microsoft.com
11/22/2006 12:00:00 AM
Hello Dave,

As for the AspNetCompiler task, it actually support supply KeyFile or some
other parameters(aspnet_compiler.exe supports), however, the MSDN document
seems misses them. I've looked up the source code of the AspNetCompiler
task class in reflector, and it supports the following
properties(parameters):

=============
public bool AllowPartiallyTrustedCallers { get; set; }
public bool Clean { get; set; }
public bool Debug { get; set; }
public bool DelaySign { get; set; }
public bool FixedNames { get; set; }
public bool Force { get; set; }
public string KeyContainer { get; set; }
public string KeyFile { get; set; }
public string MetabasePath { get; set; }
public string PhysicalPath { get; set; }
private string ProjectName { get; }
private string TargetName { get; }
public string TargetPath { get; set; }

public bool Updateable { get; set; }
public string VirtualPath { get; set; }
==============

Therefore, you can use use "KeyFile" property to supply strong-name key
file as below:

===============
<AspNetCompiler
VirtualPath="/MyWebSite"
PhysicalPath=".\mbtest"
TargetPath=".\precompiledweb"
Force="true"
Debug="true"

KeyFile="$(KeyFilePath)"

/>
=====================

In addition, for normal tool execution scernario, you can use the "Exec"
task to execute any commandline utility , e.g.

the following build.xml file first use sn.exe to create a snk file and then
strong-named the precompiled ASP.NET assembly (use Exec Task):
===========build.xml===================
<Project DefaultTargets="TestTarget"

xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<KeyFilePath>.\build.snk</KeyFilePath>
</PropertyGroup>



<Target Name="TestTarget">

<Message Text="Hello World!" />

<Exec
WorkingDirectory="D:\temp\build_temp\tasks"
Command="sn.exe -k $(KeyFilePath)"
/>


<Exec
WorkingDirectory="D:\temp\build_temp\tasks"
Command="aspnet_compiler.exe -f -keyfile $(KeyFilePath) -v /MyApp -p
..\mbtest

..\mbtestcompiled"/>


</Target>


</Project>
========================================

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.


AddThis Social Bookmark Button