Imported project was not found.

Apr 3, 2012 at 2:01 PM
Edited Apr 3, 2012 at 2:04 PM

Hi all,

       I am trying to improve my web page's performance. I installed the AjaxMinifier & MSbuild in my Windows7(X64) machine with Visual Studio2010. I modified my csproj file as below,

 

<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\ajaxmin.tasks" />
  <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.-->
  <Target Name="BeforeBuild">
    <ItemGroup>
      <GeneratedCSSJS Include="client/combined.1.css" />
      <GeneratedCSSJS Include="client/combined.1.js" />
    </ItemGroup>
    <Delete Files="@(GeneatedCSSJS)" />
  </Target>
  <Target Name="AfterBuild">
    
  </Target>

 

But when I try reloading my projecting in Visual Studio, it throws the error,

The imported project "C:\Program Files(x86)\MSBuild\4.0\MSBuild.ExtensionPack.tasks" was not found. Confirm that the path in the <import> declaration is correct, and the file exists on the disk in the below line,

<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>

Any suggestions?

 

<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\ajaxmin.tasks" />
  <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.-->
  <Target Name="BeforeBuild">
    <ItemGroup>
      <GeneratedCSSJS Include="client/combined.1.css" />
      <GeneratedCSSJS Include="client/combined.1.js" />
    </ItemGroup>
    <Delete Files="@(GeneatedCSSJS)" />
  </Target>
  <Target Name="AfterBuild">
    <MSBuild.ExtensionPack.FrameWork.Assembly TaskAction="GetInfo" NetAssembly="@(OutputPath)\PerformanceAfter.dll" />
    <Output TaskParameter="OutputItems" ItemName="Info" />
    <Message Text="Version : %(Info.AssemblyVersion)" Importance="high" />
    <!-- CSS files minification.-->
    <ItemGroup>
      <CSSMin Include="Styles\spirite.css" />
    </ItemGroup>
    <ItemGroup>
      <CSSCat Include="Styles\spirite.min.css" />
    </ItemGroup>
    <ItemGroup>
      <JSMin Include="Scripts\JiJiDrag.js" />
      <JSMin Include="Scripts\PrintPreview.js" />
      <JSMin Include="Scripts\Rotator.js" />
    </ItemGroup>
    <ItemGroup>
      <JSCat Include="Scripts\JiJiDrag.js" />
      <JSCat Include="Scripts\PrintPreview.js" />
      <JSCat Include="Scripts\Rotator.js" />
    </ItemGroup>
    <!-- Actual minimization & combine tasks.-->
    <Message Text="Minimizing JS and CSS files..." Importance="high" />
    <AjaxMin JsSourceFiles="@(JSMIN)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".min.js" CssSourceFiles="@(CSSMIN)" CssSourceExtensionPattern=".\css$" CssTargetExtension=".min.css" />
    <Message Text="Concatinating JS and CSS files" Importance="high" />
    <ReadLinesFromFile File="%(JSCat.Identity)">
      <Output TaskParameter="Lines" ItemName="JSLines" />
    </ReadLinesFromFile>
    <WriteLinesToFile File="client/combined.%(Info.AssemblyVersion).min.js" Lines="@JSLines" OverWrite="true" />
    <ReadLinesFromFile File="%(CSSCat.Identity)">
      <Output TaskParameter="Lines" ItemName="CSSLines" />
    </ReadLinesFromFile>
    <WriteLinesToFile File="client/combined.%(Info.AssemblyVersion).min.css" Lines="@CSSLines" OverWrite="true" />
    <ItemGroup>
      <Content Include="client/combined.%(Info.AssemblyVersion).min.js" />
      <Content Include="client/combined.%(Info.AssemblyVersion).min.css" />
    </ItemGroup>
  </Target>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\ajaxmin.tasks" />
  <Import Project="$(MSBuildExtensionsPath)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.-->
  <Target Name="BeforeBuild">
    <ItemGroup>
      <GeneratedCSSJS Include="client/combined.1.css" />
      <GeneratedCSSJS Include="client/combined.1.js" />
    </ItemGroup>
    <Delete Files="@(GeneatedCSSJS)" />
  </Target>
  <Target Name="AfterBuild">
    <MSBuild.ExtensionPack.FrameWork.Assembly TaskAction="GetInfo" NetAssembly="@(OutputPath)\PerformanceAfter.dll" />
    <Output TaskParameter="OutputItems" ItemName="Info" />
    <Message Text="Version : %(Info.AssemblyVersion)" Importance="high" />
    <!-- CSS files minification.-->
    <ItemGroup>
      <CSSMin Include="Styles\spirite.css" />
    </ItemGroup>
    <ItemGroup>
      <CSSCat Include="Styles\spirite.min.css" />
    </ItemGroup>
    <ItemGroup>
      <JSMin Include="Scripts\JiJiDrag.js" />
      <JSMin Include="Scripts\PrintPreview.js" />
      <JSMin Include="Scripts\Rotator.js" />
    </ItemGroup>
    <ItemGroup>
      <JSCat Include="Scripts\JiJiDrag.js" />
      <JSCat Include="Scripts\PrintPreview.js" />
      <JSCat Include="Scripts\Rotator.js" />
    </ItemGroup>
    <!-- Actual minimization & combine tasks.-->
    <Message Text="Minimizing JS and CSS files..." Importance="high" />
    <AjaxMin JsSourceFiles="@(JSMIN)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".min.js" CssSourceFiles="@(CSSMIN)" CssSourceExtensionPattern=".\css$" CssTargetExtension=".min.css" />
    <Message Text="Concatinating JS and CSS files" Importance="high" />
    <ReadLinesFromFile File="%(JSCat.Identity)">
      <Output TaskParameter="Lines" ItemName="JSLines" />
    </ReadLinesFromFile>
    <WriteLinesToFile File="client/combined.%(Info.AssemblyVersion).min.js" Lines="@JSLines" OverWrite="true" />
    <ReadLinesFromFile File="%(CSSCat.Identity)">
      <Output TaskParameter="Lines" ItemName="CSSLines" />
    </ReadLinesFromFile>
    <WriteLinesToFile File="client/combined.%(Info.AssemblyVersion).min.css" Lines="@CSSLines" OverWrite="true" />
    <ItemGroup>
      <Content Include="client/combined.%(Info.AssemblyVersion).min.js" />
      <Content Include="client/combined.%(Info.AssemblyVersion).min.css" />
    </ItemGroup>
  </Target>
Coordinator
Apr 3, 2012 at 2:23 PM

you need to install the 32bit v4 install.

 

Mike

Apr 3, 2012 at 2:34 PM

Thanks mikefourie, it works. Now I am getting the below build error,

 

The expression "@(OutputPath)\PerformanceAfter.dll" cannot be used in this context. Item lists cannot be concatenated with other strings where an item list is expected. Use a semicolon to separate multiple item lists.

 

<MSBuild.ExtensionPack.FrameWork.Assembly TaskAction="GetInfo" NetAssembly="@(OutputPath)\PerformanceAfter.dll">
      <Output TaskParameter="OutputItems" ItemName="Info" />
    </MSBuild.ExtensionPack.FrameWork.Assembly>

Coordinator
Apr 3, 2012 at 2:37 PM

I think you want to use $ instead of @

Apr 3, 2012 at 2:44 PM

Thanks Mike. Sorry for the very basic questions, since i am not much familiar with .csproj edit.

Apr 4, 2012 at 8:18 AM

I used the below line and I got written "@JSLines" in the target file. Please guide me

 

 

<WriteLinesToFile File="scripts/reduced_script.min.js" Lines="@JSLines" OverWrite="true" />

 

 

Coordinator
Apr 4, 2012 at 9:20 AM

you need  braces

@(JSLines)