Re: Dotfuscator and ClickOnce
- From: v-lliu@xxxxxxxxxxxxxxxxxxxx (Linda Liu[MSFT])
- Date: Thu, 23 Jul 2009 08:41:04 GMT
Hi Stewart,
After spending several hours on this issue, I find a better solution to
your problem.
Firstly, Visual Studio uses MSBuild to build and publish ClickOnce
applications. Please read the following MSDN documents for information on
MSBuild:
"MSBuild Overview"
http://msdn.microsoft.com/en-us/library/ms171452.aspx
"MSBuild Targets"
http://msdn.microsoft.com/en-us/library/ms171462.aspx
"MSBuild Tasks"
http://msdn.microsoft.com/en-us/library/ms171466.aspx
Secondly, every Visual Studio project imports the Microsoft.Common.targets
file, which describes the steps to build and publish an application in
common. The Microsoft.Common.targets file resides in the
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\. Open this file with Notepad
and you can see the detailed information on the tasks performed when you
build and publish an application with Visual Studio.
As you can see, there're targets called Build and PublishOnly in the
Microsoft.Common.targets file. Visual Studio uses these two targets to
build and publish projects. The Build target build the project and generate
ClickOnce manifests. So we need to do the obfuscation after the main
assembly is generated and before the ClickOnce manifests are created.
Fortunately, there's a AfterCompile target, which is built after the
Compile target (which means the main assembly has been generated), and
before the GenerateManifets target (which will generate ClickOnce
manifests). The solution is to add a task inside the "AfterCompile" target
to the project file to call the Dotfuscator command line. Open the project
file with Notepad and add the following snippet after the <Import
Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"/>:
<Target Name="AfterCompile">
<Exec Command="path\Dotfuscator /in:
$(IntermediateOutputPath)appname.exe /out: $(IntermediateOutputPath) "/>
</Target>
Save the project file and reload the project in Visual Studio. Clear and
publish the project within Visual Studio. You should see the generated
executable is obfuscated and then published successfully.
In addition, you can execute the MSBuild command in Visual Studio 2005
Command Prompt to build and publish the project. It's equivalent to
building and publishing within VS and what's important is that you can see
detailed information when MSBuild builds and publishs the project which is
always useful. The command line looks like:
msbuild path\projectname.csproj /t:build, publishonly
Please try my suggetion to see if there's any problem.
Sincerely,
Linda Liu
Microsoft Online Community Support
.
- Follow-Ups:
- Re: Dotfuscator and ClickOnce
- From: Stewart Berman
- Re: Dotfuscator and ClickOnce
- From: Stewart Berman
- Re: Dotfuscator and ClickOnce
- From: Stewart Berman
- Re: Dotfuscator and ClickOnce
- From: Stewart Berman
- Re: Dotfuscator and ClickOnce
- References:
- Dotfuscator and ClickOnce
- From: Stewart Berman
- RE: Dotfuscator and ClickOnce
- From: Linda Liu[MSFT]
- Re: Dotfuscator and ClickOnce
- From: Stewart Berman
- Dotfuscator and ClickOnce
- Prev by Date: Re: to dispose or not ?
- Next by Date: Auto save gridview... or give a confirmation when leaving
- Previous by thread: Re: Dotfuscator and ClickOnce
- Next by thread: Re: Dotfuscator and ClickOnce
- Index(es):
Relevant Pages
|
Loading