Freigeben über


ClickOnce -- TargetFrameworkVersion

Issue:

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

Though the ClickOnce application is set to ToolsVersion="3.5" and the TargetFrameworkVersion is v.3.5 we see that when building with TFS 2010 the manifest includes the following dependency

<dependency>

<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">

<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />

</dependentAssembly>

</dependency>

By including the above dependency we are making .NET Framework 4.0 as a mandatory prerequisite for our application, which is incorrect.

This is because TFS 2010 build installs MSBUILD 4.0

How to repro this:

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

1. Create a windows app using VS 2008 targeting .NET Framework 2.0

2. Make sure we set the publish properties correct in the publish properties page of the VS 2008.

3. Also, sign the clickonce manifests using a test cert.

4. Make sure we save the project without building.

Now proceed to the next steps:

1. Launch the VS 2010 command prompt and use the 4.0 msbuild to build and publish the same app after clearing the publish file created in the TEST A.

msbuild /target:publish "projectname.vbproj"

2. Once the publish is success, look at the publish folder for the application manifest and in the app manifest we could find the following.

<dependency>
<dependentAssembly dependencyType="preRequisite" allowDelayedBinding="true">
<assemblyIdentity name="Microsoft.Windows.CommonLanguageRuntime" version="4.0.30319.0" />
</dependentAssembly>
</dependency>

Workarounds to fix the above problem:

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

1. Use c:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe to publish your project. This should always work.

2. Set <Project ToolsVersion="3.5" to <Project ToolsVersion="4.0" in your *.csproj or *.vbproj file. and Publish using c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.

If the above are not an option, then you could try the following too:

Change the following lines in the TFSBuild.proj

From:

<MSBuild Projects="$(SolutionRoot)/QA/Dev/Src/Discovery.Win.App/Discovery.Win.App.csproj"
Properties="PublishDir=$(DropLocation)/$(BuildNumber)/Release/Discovery/;ApplicationVersion=$(VerMajor).$(VerMinor).$(VerBuild).$(VerRevision);InstallUrl=$(DiscoveryInstallUrl)"
Targets="Publish" />

To:

<MSBuild ToolsVersion="3.5" Projects="$(SolutionRoot)/QA/Dev/Src/Discovery.Win.App/Discovery.Win.App.csproj"
Properties="ClrVersion=2.0.50727.0;PublishDir=$(DropLocation)/$(BuildNumber)/Release/Discovery/;ApplicationVersion=$(VersionMajor).$(VersionMinor).$(VersionBuild).$(VersionRevision);PublishUrl=$(DiscoveryWinAppPublishUrl);InstallUrl=$(DiscoveryWinAppPublishUrl);Install=false;InstallFrom=Web"
Targets="Publish"/>

 

Thanks,
Aditya Hari

Comments

  • Anonymous
    October 20, 2010
    Hi Hari! Thanks for your post. We got exactly the same problems. For me it looks like a bug in MSBUILD 4. How do you think. Did you created bug in ms connect?