473,386 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

web deployment project AfterBuild

In a web deployment project I want to encrypt the connection strings.
I use to do this with a batch file with something like this.

aspnet_regiis.exe -pef "connectionStrings" ..\ -prov "HrCustomProvider"

I know I need to use
<Exec Command='aspnet_regiis.exe -pef "connectionStrings" ..\ -prov
"HrCustomProvider"' />

but I cant get it to work.

I don't want to hard code the path to aspnet_regiis incase this changes.
I don't know where the relative path to web.config when this runs either.

Feb 23 '07 #1
10 2977
Hello Chuck,

See there http://msdn2.microsoft.com/en-us/library/ms998280.aspx

---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

CPIn a web deployment project I want to encrypt the connection
CPstrings. I use to do this with a batch file with something like
CPthis.
CP>
CPaspnet_regiis.exe -pef "connectionStrings" ..\ -prov
CP"HrCustomProvider"
CP>
CPI know I need to use
CP<Exec Command='aspnet_regiis.exe -pef "connectionStrings" ..\
CP-prov
CP"HrCustomProvider"' />
CPbut I cant get it to work.
CP>
CPI don't want to hard code the path to aspnet_regiis incase this
CPchanges. I don't know where the relative path to web.config when
CPthis runs either.
CP>
Feb 23 '07 #2
I probably wasn't clear.

That's the way I do it now.
What I want to change is to put those commands in to a Web Deployment
Project and have them actually complete.
I know I need to edit the WDP project file and add something like:
In a web deployment project I want to encrypt the connection strings.
I use to do this with a batch file with something like this.
<Exec Command='aspnet_regiis.exe -pef "connectionStrings" ..\ -prov
"HrCustomProvider"' />

but I cant get it to work.

I don't want to hard code the path to aspnet_regiis in case this changes.
I don't know where the relative path to web.config when this runs either.

Feb 23 '07 #3
Hello Chuck,

As for the encrypting web.config section through web deployment project
post-build event problem, I think it is caused by the path of the
aspnet_regiis.exe tool and the path of the precompile application(its
application root dir).

For the aspnet_regiis.exe, unless you're executing it in a command promtp
that has already add the framework path into environment variables, you
need to use the full qualified path .e.g.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspn et_regiis.exe

If you want to add flexibility, you can add a custom property in your build
xml file and use that property to set the framework dir, e.g.

====================
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<netfxdir>%windir%\Microsoft.NET\Framework\v2.0.50 727\</netfxdir>
...................
<Exec WorkingDirectory="$(OutputPath)"
Command="$(netfxdir)aspnet_regiis.exe -pef connectionStrings ." />
.....................
============================

I use the "$(OutputPath)" variable to set the working directory so that I
can use "." to represent the physical path of the output precompiled
ASP.NET application. Based on my test, such path like "..\ ..." or
".\debug" will not work.

You can try the above configuration to see whether it work o your side.

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/subscripti...ult.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/subscripti...t/default.aspx.

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

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

Feb 26 '07 #4
Thanks, Steven
That got it.
Feb 27 '07 #5
I wish their was a way to get the location of the compiler. I know something
installs an environment variable vs80comntools that contains the path to a
batch file to set environment variables.

When I compile with batch files, I do the following.
if "%VS80COMNTOOLS%"=="" goto error_no_VS80COMNTOOLS

rem set path of aspnet_compiler for the framework in vs80
call "%VS80COMNTOOLS%vsvars32.bat"

echo.
echo compling with Framework %FrameworkVersion%

Feb 27 '07 #6
Thanks for your reply Chuck,

Yes, it would be much better if the .net framework system folder has a
system environment variable point to it. So far there is only some
variables of path to visual studio tools (if the machine has visual studio
installed). Anyway, since the .net framework folder structure is always
fixed, you can use the %windir% to concatenate the other part so as to
construct the whole path.

Also, if you meet any other problem we can help, please feel free to post
here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 28 '07 #7
I don't really understand how the web deployment project addin interfaces
with msbuild.
When you build a web deployment project in VS how does it know what version
of the framework to pick and where the complier is?

Feb 28 '07 #8
Hi Chuck,

Thanks for your followup.

For your further question about how the web deployment project deal with
..net framework version. It is actually what Visual Studio do, web
deployment project do not to care about this. Each version of visual
studio only targets a fixed version of .net framework. For example, VS.NET
2002 target .net framework 1.0, VS.NET 2003 target .net framework 1.1
while Visual Studio 2005 only target .net framework 2.0 development.

therefore, the web deployment project will surely pickup .net framework 2.0
to compile.

Also, webdeployment project do not quite care whether it is invoked by
visual studio or MSBUILD. From underlying view, it only product a build
configuration file(xml format) which can be parsed by both visual studio
and MSBUILD.exe so that both of them can correctly perform the compiling
according to the setting in the web deployment project file(xml config).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 1 '07 #9

Thanks Steven,
FYI,
I found a (reserved property) variable to the compiler

$(MSBuildBinPath)
Mar 8 '07 #10
Thanks for your followup and share your finding with us.

Have a nice day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Mar 9 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: DBxGlock | last post by:
I'm trying to create the equivalent of a post build event for a website. I have the "Web Deployment Projects" add-in installed and am attempting to follow the instructions in the "Using Web...
0
by: Grant | last post by:
Hi, The TargetDir alias is empty when using it in the AfterBuild section of a Web Deployment Project. As per the MSDN article Using Web Deployment Projects with Visual Studio 2005, I have the...
6
by: andrewbb | last post by:
I want to deploy a service with a windows app and the setup program must conform to the Vista certification requirements. Can that be done with the standard .net setup project? Assuming cost is...
2
by: GaryDean | last post by:
Regardless if I use the Publish feature of vs2005 or the addin Web Deployment Project I can't seem to get the necessary files deployed. For instance my bin directory has several .licx files but...
3
by: =?Utf-8?B?Q2h1Y2sgUA==?= | last post by:
I have an asp.net project with an WebDeployment Project. At the end of the msbuild file I put: <Target Name="AfterBuild"> <Exec WorkingDirectory="$(OutputPath)"...
4
by: Max2006 | last post by:
Hi, When I use Web Deployment Project to create a deployment image of my web site, It includes un-necessaty files such as *.csproj files. Can I disable the deployment of *.csproj files?
7
by: Cirene | last post by:
I used to use the Web Deployment Project with my VS2005 projects. Now I've fully upgraded to VS2008. Do I have to download a new version of the Web Deployment Project? If so where can I find...
1
by: shapper | last post by:
Hello, I am using Visual Studio 2008 and Web Deployment Projects: http://connect.live.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=319288 In my web site I have a folder named...
2
by: shapper | last post by:
Hello, I am using Visual Studio 2008 and Web Deployment Projects:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.