0%

I’m using the property MSBuildProjectDirectory with MSBuild.
The project is located in:

C:\Program Files (x86)\Jenkins\workspace\MyProject

and MSBuild will get a “The system cannot find the file specified” error.

please instead of

$([MSBuild]::Unescape('$(MSBuildProjectDirectory)'))

Download “Git 2.8.0 for Windows” from git-scm site
Download Bitvise SSH Server (WinSSHD) 6.45 from bitvise

Install Git for windows and setup login account

install git

Create Git Repos Root Folder

1
D:/Demo/GitRepos

Create test folder and open bash command

1
C:/User/vdevp/GitRepos>md test

git-bash-here

1
2
vdevp@vdevp-PC MINGW64 /c/User/vdevp/GitRepos/test
$ git init --bare

Git will create many initialize files

git-init

Go to your client PC and create test folder

1
D:/Demo/test

open Git bash command

1
2
3
4
5
6
7
$ git clone ssh://vdevp@192.168.2.3/~/GitRepos/test
Cloning into 'test'...
vdevp@192.168.2.3's password:
'git-upload-pack' is not recognized as an internal or external command, operable program or batch file.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

If you see the error message, please go to Server add system PATH environment

1
C:\Program Files (x86)\Git\bin;C:\Program Files\Git\mingw64\libexec\git-core

The best way to install .NET Core on Windows is to download the official MSI installer. This installer will install the tools and put them on your PATH.

If you are using Windows 7, Windows Server 2008 or Windows Server 2012 you will also need to install Visual C++ Redistributable for Visual Studio 2012 Update 4 & Visual C++ Redistributable for Visual Studio 2015 .

Initialize some code for console application

1
2
3
C:\>mkdir hwapp
C:\>cd hwapp
C:\>dotnet new

The first command will restore the packages specified in the project.json file, and the second command will run the actual sample:

1
2
C:\>dotnet restore
C:\>dotnet run

update npm

1
npm install -g npm

Initialize yo

1
2
3
npm install -g yo
npm install -g generator-webapp
npm install -g generator-aspnet

To scaffold a new aspnet project, run:

1
yo aspnet

yo-aspnet

Now lets create using Visual Studio yo extension, install yo extension first.

Intellisense Key Bindings for Visual Studio Code

|
|Key |Command |Command id
|Ctrl+Space |Trigger Suggest |editor.action.triggerSuggest

Add Static Files packages and restore “project.json”

1
2
3
4
"dependencies": {
...,
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
}

From the Command Palette in VS Code

dotnet restore

Install ASP.NET 5

Enable the ASP.NET 5 command-line tools. Open a command-prompt and run:

dnvm upgrade

This will make the default .NET Execution Environment (DNX) active on the path.

On Windows 7 and Windows Server 2008 R2 you will also need to install the Visual C++ Redistributable for Visual Studio 2012 Update 4.

1
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}"

Once this step is complete you should be able to run dnvm and see some help text.

Use DNVM to install DNX for .NET Core:

dnvm upgrade -r coreclr

Use DNVM to install DNX for the full .NET Framework:

dnvm upgrade -r clr

Install the requested DNX version from the feed, create console application using .NET Core

dnvm install -a x64 -r coreclr 1.0.0-rc1-final

Install generator

npm install -g yo generator-aspnet

Create Develop folder and generate console project

yo aspnet

1
2
$npm install -g gulp
$npm install gulp-autoprefixer --save-dev

Create gulpfile.js file in root project path folder

EXTENDING OUR .CSPROJ WITH CUSTOM TARGETS

Manually edit your .csproj file and at the bottom (must be after all Import lines) we’re going to add some new content.

1
2
3
4
5
6
7
8
9
10
<PropertyGroup>
<CompileDependsOn>
$(CompileDependsOn);
GulpBuild;
</CompileDependsOn>
</PropertyGroup>
<Target Name="GulpBuild" DependsOnTargets="CompileTypeScript">
<Exec Command="npm install" />
<Exec Command="gulp" />
</Target>

What about triggering a gulp cleanup script when we clean our solution in Visual Studio? It’s a very similar extension:

1
2
3
4
5
6
7
8
9
<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
GulpClean
</CleanDependsOn>
</PropertyGroup>
<Target Name="GulpClean">
<Exec Command="gulp clean" />
</Target>

HOOKING INTO WEB DEPLOY

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
$(CopyAllFilesToSingleFolderForPackageDependsOn);
CollectGulpOutput;
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
$(CopyAllFilesToSingleFolderForMsdeployDependsOn);
CollectGulpOutput;
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="CollectGulpOutput">
<ItemGroup>
<_CustomFiles Include="build\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>build\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
<Message Text="CollectGulpOutput list: %(_CustomFiles.Identity)" />
</Target>

Want Ajax Minifier to be packaged with your project? From the Ajax Minifier install folder, you can move AjaxMin.dll and AjaxMinTask.dll directly into your source directory. I put them in my App_Data folder. Once they’re somewhere in your source, in Visual Studio right-click them, select Include in Project, and also change their Build Action property to None.

Then in the code I included above, change

1
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Microsoft Ajax Minifier\ajaxmin.tasks" />

to

1
<UsingTask TaskName="AjaxMin" AssemblyFile="$(MSBuildProjectDirectory)\App_Data\AjaxMinTask.dll" />

Done.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<UsingTask TaskName="AjaxMin" AssemblyFile="$(MSBuildProjectDirectory)\DLL\AjaxMinTask.dll" />
<Target Name="AfterBuild" Condition="'$(ConfigurationName)'=='Debug'">
<ItemGroup>
<JS Include="app\**\*.js" Exclude="**\*.min.js;obj\**\*.*" />
<CSS Include="app\**\*.css" Exclude="**\*.min.css;obj\**\*.*" />
</ItemGroup>
<AjaxMin JsSourceFiles="@(JS)" JsSourceExtensionPattern="\.js$" JsTargetExtension="-min.js" CssSourceFiles="@(CSS)" CssSourceExtensionPattern="\.css$" CssTargetExtension="-min.css" />
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<MinJS Include="**\*.jsMIN" />
<FilesForPackagingFromProject Include="%(MinJS.Identity)">
<DestinationRelativePath>%(RecursiveDir)%(Filename).js</DestinationRelativePath>
</FilesForPackagingFromProject>
<MinCSS Include="**\*.cssMIN" />
<FilesForPackagingFromProject Include="%(MinCSS.Identity)">
<DestinationRelativePath>%(RecursiveDir)%(Filename).css</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>

Developing a Custom Rewrite Provider for URL Rewrite Module

Creating a Visual Studio C# Class Library Project

  • add references to Microsoft.Web.Iis.Rewrite.dll located in “%ProgramFiles%\Reference Assemblies\Microsoft\IIS”.

Rewrite providers must be placed in the .NET Global Assembly Cache (GAC)

  • To sign the assembly, In the Signing tab check “Sign the assembly” check box.

In the combo box, select the option <New…> to create a new key. In the “Create Strong Name Key” dialog, type DemoKey.snk as the name for the key and uncheck the Protect my key file with a password check box. Click OK.

iis-url-rewrite

  • Select the “Build Events” tab and add the following “Post-build event” command line:
1
2
CALL "%VS90COMNTOOLS%\vsvars32.bat" > NULL
gacutil.exe /if "\$(TargetPath)"

Note: if you use Visual Studio 2010 then replace %VS90COMNTOOLS% with %VS100COMNTOOLS%.

Implementing the provider interfaces

1
2
3
public class CdnRewriteProvider : IRewriteProvider, IProviderDescriptor
{
}

Registering and configuring the provider

  • Open IIS Manager and select the URL Rewrite feature

Step1

Step2

Step3

This completes the registration and configuration of a rewrite provider. As a result the web.config file for the default web site will contain the following XML code inside of the section:

1
2
3
4
5
6
7
8
9
10
11
<system.webServer>
<rewrite>
<providers>
<provider name="T1.IisUrlRewriteModule" type="T1.IisUrlRewriteModule.CdnRewriteProvider, T1.IisUrlRewriteModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd92a3df2f0d20b9">
<settings>
<add key="config" value="aaa" />
</settings>
</provider>
</providers>
</rewrite>
</system.webServer>

Create a GitHub Account

Create a new Repository name: “username.github.io”

username must same as account name

Install Node.js

1
2
3
npm install hexo -g
npm init Blog
cd Blog

npm install

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
npm install hexo-generator-index --save
npm install hexo-generator-archive --save
npm install hexo-generator-category --save
npm install hexo-generator-tag --save
npm install hexo-server --save
npm install hexo-deployer-git --save
npm install hexo-deployer-heroku --save
npm install hexo-deployer-rsync --save
npm install hexo-deployer-openshift --save
npm install hexo-renderer-marked@0.2 --save
npm install hexo-renderer-stylus@0.2 --save
npm install hexo-generator-feed@1 --save
npm install hexo-generator-sitemap@1 --save
npm install hexo-tag-bootstrap --save
npm install hexo-generator-search --save

Process the following command, and visit localhost:4000 to see the result

1
hexo server

The Following command that generate public folder, you can deploy it to your target site folder.

1
hexo g

Modify _config.yml file in Blog Folder

1
2
3
4
deploy:
type: git
repo: https://github.com/username/username.github.io.git
branch: master

Deploy to GitHub command

1
hexo d -g

Other

1
2
hexo n #Generate articles,or source\_posts manually edit/create md file
hexo s #deploy preview result

Update Hexo

1
npm update -g

Install Other Theme

1
git clone https://github.com/MOxFIVE/hexo-theme-yelee.git themes/yelee

Modify themes/yelee/_config.yml

React Flow

React Flow

Create Actions

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import $ = require('jquery');
import t1 = require('t1');
import FReflux = t1.FReflux;
import FRefluxActions = t1.FRefluxActions;

enum Demo1ActionType {
Request
}

export class Demo1Actions extends FRefluxActions<Demo1ActionType> {
constructor() {
super(Demo1ActionType);
}

Request(name: string) {
this.dispatchEvent(Demo1ActionType.Request, name);
}
}

Create Store

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import t1 = require('t1');
import FReflux = t1.FReflux;
import FRefluxStore = t1.FRefluxStore;

export class Demo1State {
name: string;
}


export class Demo1Store extends FRefluxStore<Demo1State> {
_state: Demo1State = new Demo1State();

constructor(actions: FRefluxActions<any>[]) {
super(actions);
}

getState(): Demo1State {
return this._state;
}
}

Create Main View

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
export interface MobileDemo1Props extends React.Props<MobileDemo1> {
history: any;
}

export class MobileDemo1 extends FRefluxStoreComponent<MobileDemo1Props, Demo1State> {
constructor() {
this.name = "MobileDemo1";
super(_app1Store);
}

componentWillMount() {
}

componentWillUnmount() {
}

componentDidMount() {
super.componentDidMount();
}

navigate() {
console.log(this.props);
this.props.history.pushState(null, "/");
//this.props.history.replaceState(null, "/");
}

render() {
return (
<div>React-Router Demo1
<Link to='Panel1'>Panel1</Link>
<Link to='Panel2'><button className="btn btn-success">Panel2</button></Link>
<button onClick={this.navigate.bind(this)}>TEST</button>
{this.props.children}
</div>
);
}
}

Create Panel1 View

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
interface Panel1Props extends React.Props<Panel1> {
}


class Panel1 extends FRefluxReducerComponent<Panel1Props, Demo1State> {
constructor() {
super();
}

getStateFromStore(state: Demo1State): Demo1State {
return state;
}

render() {
return (
<div>
Hello Panel-1
</div>
);
}
}

Render

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import * as Router from 'react-router';
import { Route, IndexRoute, Link } from 'react-router';

var routeMap = (
<Route path="/" component={MobileDemo1}>
<IndexRoute component={Panel1}/>
<Route path="Panel1" component={Panel1}/>
<Route path="Panel2" component={Panel2}/>
<Route path="*" component={NotFoundPage} />
</Route>
);

ReactDOM.render(
<Router.Router history={Router.browserHistory}>
{routeMap}
</Router.Router>,
document.getElementById('app1')
);

Main.js

1
2
3
4
5
6
7
8
9
10
11
12
(function(){
var baseUrl = "/js/Samples/ReactRouterDemo1/";

require.config({
paths: {
"App": baseUrl + "App",
}
});
})();

define(["require", "exports", 'App'], function (require, exports, app) {
});

HTML

1
2
3
4
5
6
7
8
9
10
11
12
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>React Router Demo1</title>
<script src="~/js/requirejs-config.js"></script>
<script src="~/Scripts/require.js" data-main="/js/Samples/ReactRouterDemo1/Main.js"></script>
</head>
<body>
<div id="app1">
</div>
</body>
</html>